1/* 2 * Copyright (c) 2022-2024 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/*** if arkts 1.2 */ 22import { ScrollableCommonMethod, NestedScrollOptions, CommonMethod, Optional, OnWillScrollCallback, OnScrollCallback } from './common'; 23import { CustomBuilder } from './builder' 24import { Length, Dimension, Margin, ConstraintSizeOptions, Resource } from './units'; 25import { Scroller, OnScrollFrameBeginCallback } from './scroll'; 26import { ScrollState } from './list' 27import { FlexDirection } from './enums' 28import { ComponentContent } from '../../arkui/ComponentContent' 29/*** endif */ 30 31/** 32 * function that returns item main size by index. 33 * 34 * @typedef { function } GetItemMainSizeByIndex 35 * @param { number } index - Index of the target water flow item.<br>Value range: [0, total number of child nodes - 1]. 36 * @returns { number } main size of the FlowItem at index 37 * @syscap SystemCapability.ArkUI.ArkUI.Full 38 * @crossplatform 39 * @atomicservice 40 * @since arkts {'1.1':'12','1.2':'20'} 41 * @arkts 1.1&1.2 42 */ 43declare type GetItemMainSizeByIndex = (index: number) => number; 44 45/** 46 * Describes the configuration of the water flow item section. 47 * 48 * @syscap SystemCapability.ArkUI.ArkUI.Full 49 * @crossplatform 50 * @atomicservice 51 * @since arkts {'1.1':'12','1.2':'20'} 52 * @arkts 1.1&1.2 53*/ 54declare class SectionOptions { 55 /** 56 * The number of FlowItems in this section. 57 * 58 * @type { number } itemsCount - Number of water flow items in the section. The value must be a positive integer. 59 * If the <em>splice</em>, <em>push</em>, or <em>update</em> APIs receive a section 60 * where the <em>itemsCount</em> value is less than 0, these APIs will not be executed. 61 * @syscap SystemCapability.ArkUI.ArkUI.Full 62 * @crossplatform 63 * @atomicservice 64 * @since arkts {'1.1':'12','1.2':'20'} 65 * @arkts 1.1&1.2 66 */ 67 itemsCount: number; 68 69 /** 70 * The columns of this section in vertical layout, or rows in horizontal layout. 71 * 72 * @type { ?number } crossCount - Number of columns (in vertical layout) or rows (in horizontal layout). 73 * <br> If the value is less than 1, the default value is used. 74 * @default 1 one column in vertical layout, or one row in horizontal layout 75 * @syscap SystemCapability.ArkUI.ArkUI.Full 76 * @crossplatform 77 * @atomicservice 78 * @since arkts {'1.1':'12','1.2':'20'} 79 * @arkts 1.1&1.2 80 */ 81 crossCount?: number; 82 83 /** 84 * Callback used to obtain the main axis size,in vp, of the water flow item at a specified index during 85 * the layout process of the WaterFlow component. 86 * 87 * <p><strong>NOTE</strong> 88 * <br>1. When both <em>onGetItemMainSizeByIndex</em> and the width or height attribute of the water flow item are used, 89 * the main axis size is determined by the return value of <em>onGetItemMainSizeByIndex</em>, 90 * which will override the main axis length of water flow item. 91 * <br>2. Using <em>onGetItemMainSizeByIndex</em> can improve the efficiency of jumping to a specific position or index in the <em>WaterFlow</em> component. 92 * Avoid mixing the use of <em>onGetItemMainSizeByIndex</em> with sections that do not have it set, as this can cause layout exceptions. 93 * <br>3. If <em>onGetItemMainSizeByIndex</em> returns a negative number, the height of the water flow item is 0. 94 * </p> 95 * 96 * @type { ?GetItemMainSizeByIndex } onGetItemMainSizeByIndex - function that returns item main size by index 97 * @syscap SystemCapability.ArkUI.ArkUI.Full 98 * @crossplatform 99 * @atomicservice 100 * @since arkts {'1.1':'12','1.2':'20'} 101 * @arkts 1.1&1.2 102 */ 103 onGetItemMainSizeByIndex?: GetItemMainSizeByIndex; 104 105 /** 106 * Gap between columns. If this parameter is not set, the value of columnsGap for the water flow is used. 107 * If this parameter is set to an invalid value, 0 vp is used. 108 * 109 * @type { ?Dimension } columnsGap - column gap of this section 110 * same with columnsGap of WaterFlow if not set 111 * @syscap SystemCapability.ArkUI.ArkUI.Full 112 * @crossplatform 113 * @atomicservice 114 * @since arkts {'1.1':'12','1.2':'20'} 115 * @arkts 1.1&1.2 116 */ 117 columnsGap?: Dimension; 118 119 /** 120 * Gap between rows. If this parameter is not set, the value of <em>rowsGap</em> for the water flow is used. 121 * If this parameter is set to an invalid value, 0 vp is used. 122 * 123 * @type { ?Dimension } rowsGap - row gap of this section 124 * same with rowsGap of WaterFlow if not set 125 * @syscap SystemCapability.ArkUI.ArkUI.Full 126 * @crossplatform 127 * @atomicservice 128 * @since arkts {'1.1':'12','1.2':'20'} 129 * @arkts 1.1&1.2 130 */ 131 rowsGap?: Dimension; 132 133 /** 134 * Padding of the section. A value of the Length type specifies the margin for all the four sides. 135 * 136 * @type { ?(Margin | Dimension) } margin - outer margin of this section 137 * @default {top: 0, right: 0, bottom: 0, left: 0} 138 * @syscap SystemCapability.ArkUI.ArkUI.Full 139 * @crossplatform 140 * @atomicservice 141 * @since arkts {'1.1':'12','1.2':'20'} 142 * @arkts 1.1&1.2 143 */ 144 margin?: Margin | Dimension; 145} 146 147/** 148 * Describes the water flow item sections. 149 * 150 * @syscap SystemCapability.ArkUI.ArkUI.Full 151 * @crossplatform 152 * @atomicservice 153 * @since arkts {'1.1':'12','1.2':'20'} 154 * @arkts 1.1&1.2 155 */ 156declare class WaterFlowSections { 157 /** 158 * A constructor used to create a <em>WaterFlowSections</em> object. 159 * 160 * @syscap SystemCapability.ArkUI.ArkUI.Full 161 * @crossplatform 162 * @atomicservice 163 * @since arkts {'1.1':'12','1.2':'20'} 164 * @arkts 1.1&1.2 165 */ 166 constructor(); 167 168 /** 169 * Changes sections by removing or replacing an existing section and/or adding a section. 170 * 171 * @param { number } start - Zero-based index at which the changing starts. The value is converted to an integer. 172 * <br><em>NOTE</em> 173 * <br>1. A negative index counts back from the end of the section list. 174 * If -<em>WaterFlowSections.length()</em> <= <em>start</em> < <em>0</em>, <em>start</em> + <em>array.length</em> is used. 175 * <br>2. If <em>start</em> < -<em>WaterFlowSections.length()</em>, <em>0</em> is used. 176 * <br>3. If <em>start</em> >= <em>WaterFlowSections.length()</em>, a new section is added at the end. 177 * @param { number } [deleteCount] - Number of sections to be deleted from the position specified by <em>start</em>. 178 * <br><em>NOTE</em> 179 * <br>1. If <em>deleteCount</em> is omitted, or if its value is greater than or equal to the number of sections from 180 * the position specified by <em>start</em> to the end of the <em>WaterFlowSections</em>, 181 * then all sections from the position specified by <em>start</em> to the end of the <em>WaterFlowSections</em> will be deleted. 182 * <br>2. If <em>deleteCount</em> is <em>0</em> or a negative number, no sections are deleted. 183 * @param { Array<SectionOptions> } [sections] - Sections to add to the section list, beginning from the position specified by <em>start</em>. 184 * If no section is specified, <em>splice()</em> will only delete sections from the <em>WaterFlow</em> component. 185 * @returns { boolean } Whether the splice was successful. 186 * @syscap SystemCapability.ArkUI.ArkUI.Full 187 * @crossplatform 188 * @atomicservice 189 * @since arkts {'1.1':'12','1.2':'20'} 190 * @arkts 1.1&1.2 191 */ 192 splice(start: number, deleteCount?: number, sections?: Array<SectionOptions>): boolean; 193 194 /** 195 * Adds the specified sections to the end of the <em>WaterFlow</em> component. 196 * 197 * @param { SectionOptions } section - Sections to add to the end of the <em>WaterFlow</em> component. 198 * @returns { boolean } Whether the push was successful. 199 * @syscap SystemCapability.ArkUI.ArkUI.Full 200 * @crossplatform 201 * @atomicservice 202 * @since arkts {'1.1':'12','1.2':'20'} 203 * @arkts 1.1&1.2 204 */ 205 push(section: SectionOptions): boolean; 206 207 /** 208 * Updates the configuration of a specified water flow item section. 209 * 210 * @param { number } sectionIndex - Zero-based index of the water flow item section to update. The value is converted to an integer. 211 * <br><em>NOTE</em> 212 * <br>1. A negative index counts back from the end of the section list. 213 * If -<em>WaterFlowSections.length()</em> <= <em>sectionIndex</em> < <em>0</em>, <em>sectionIndex</em> + <em>array.length</em> is used. 214 * <br>2. If <em>sectionIndex</em> < -<em>WaterFlowSections.length()</em>, <em>0</em> is used.<br> 215 * 3. If <em>sectionIndex</em> >= <em>WaterFlowSections.length()</em>, a new section is added at the end. 216 * @param { SectionOptions } section - New section configuration. 217 * @returns { boolean } Whether the update was successful. 218 * @syscap SystemCapability.ArkUI.ArkUI.Full 219 * @crossplatform 220 * @atomicservice 221 * @since arkts {'1.1':'12','1.2':'20'} 222 * @arkts 1.1&1.2 223 */ 224 update(sectionIndex:number, section: SectionOptions): boolean; 225 226 /** 227 * Obtains the configuration of all sections in the <em>WaterFlow</em> component. 228 * 229 * @returns { Array<SectionOptions> } Returns all the section options in the WaterFlow. 230 * @syscap SystemCapability.ArkUI.ArkUI.Full 231 * @crossplatform 232 * @atomicservice 233 * @since arkts {'1.1':'12','1.2':'20'} 234 * @arkts 1.1&1.2 235 */ 236 values(): Array<SectionOptions>; 237 238 /** 239 * Obtains the number of sections in the <em>WaterFlow</em> component. 240 * 241 * @returns { number } Returns section counts in the WaterFlow. 242 * @syscap SystemCapability.ArkUI.ArkUI.Full 243 * @crossplatform 244 * @atomicservice 245 * @since arkts {'1.1':'12','1.2':'20'} 246 * @arkts 1.1&1.2 247 */ 248 length(): number; 249} 250 251/** 252 * Declare layout modes of WaterFlow. 253 * 254 * @enum { number } 255 * @syscap SystemCapability.ArkUI.ArkUI.Full 256 * @crossplatform 257 * @atomicservice 258 * @since arkts {'1.1':'12','1.2':'20'} 259 * @arkts 1.1&1.2 260 */ 261declare enum WaterFlowLayoutMode { 262 /** 263 * Default layout mode where water flow items are arranged from top to bottom. Items in the viewport depend on the layout of all items above them. 264 * As such, in cases of redirection or switching the number of columns, the layout of all items above the viewport must be recalculated. 265 * 266 * @syscap SystemCapability.ArkUI.ArkUI.Full 267 * @crossplatform 268 * @atomicservice 269 * @since arkts {'1.1':'12','1.2':'20'} 270 * @arkts 1.1&1.2 271 */ 272 ALWAYS_TOP_DOWN = 0, 273 274 /** 275 * Sliding window mode. This mode only takes into account the layout in the viewport, 276 * without depending on water flow items above the viewport. 277 * 278 * <p><strong>NOTE</strong> 279 * <br> 1. During a non-animated redirection to a distant location, water flow items are laid out forward or backward based on the target position. 280 * If the user then swipes back to the position prior to the redirection, the layout of the content may not be consistent with its previous state. 281 * This can lead to misalignment of the top nodes when the user swipes back to the top after the redirection. 282 * To counteract this issue, in this layout mode, the layout will be automatically adjusted after reaching the top of 283 * the viewport to ensure that the top is aligned. 284 * If there are multiple sections, adjustments will be made to the sections within the viewport when scrolling ends. 285 * <br> 2. The total offset returned by the currentOffset API of scroller is inaccurate after a redirection or data update. 286 * This offset will be recalibrated when the user swipes back to the top. 287 * <br> 3. If a jump action (for example, by calling scrollToIndex without animation or scrollEdge) and 288 * an input offset (such as from a swipe gesture or a scrolling animation) are both initiated within the same frame, both will be executed. 289 * <br> 4. If the scrollToIndex API is called without animation to jump to a distant position (beyond the range of visible water flow items in the window), 290 * the total offset is calculated in the sliding window mode. 291 * </p> 292 * 293 * @syscap SystemCapability.ArkUI.ArkUI.Full 294 * @crossplatform 295 * @atomicservice 296 * @since arkts {'1.1':'12','1.2':'20'} 297 * @arkts 1.1&1.2 298 */ 299 SLIDING_WINDOW = 1, 300} 301 302/** 303 * Defines the water flow options. 304 * 305 * @interface WaterFlowOptions 306 * @syscap SystemCapability.ArkUI.ArkUI.Full 307 * @since 9 308 */ 309/** 310 * Defines the water flow options. 311 * 312 * @interface WaterFlowOptions 313 * @syscap SystemCapability.ArkUI.ArkUI.Full 314 * @crossplatform 315 * @since 10 316 */ 317/** 318 * Provides parameters of the <em>WaterFlow</em> component. 319 * 320 * @interface WaterFlowOptions 321 * @syscap SystemCapability.ArkUI.ArkUI.Full 322 * @crossplatform 323 * @atomicservice 324 * @since arkts {'1.1':'11','1.2':'20'} 325 * @arkts 1.1&1.2 326 */ 327declare interface WaterFlowOptions { 328 /** 329 * Describes the water flow footer. 330 * 331 * @type { ?CustomBuilder } 332 * @syscap SystemCapability.ArkUI.ArkUI.Full 333 * @since 9 334 */ 335 /** 336 * Describes the water flow footer. 337 * 338 * @type { ?CustomBuilder } 339 * @syscap SystemCapability.ArkUI.ArkUI.Full 340 * @crossplatform 341 * @since 10 342 */ 343 /** 344 * Footer of the WaterFlow component. 345 * 346 * @type { ?CustomBuilder } 347 * @syscap SystemCapability.ArkUI.ArkUI.Full 348 * @crossplatform 349 * @atomicservice 350 * @since arkts {'1.1':'11','1.2':'20'} 351 * @arkts 1.1&1.2 352 */ 353 footer?: CustomBuilder; 354 355 /** 356 * Footer of the WaterFlow component. 357 * 358 * @type { ?ComponentContent } 359 * @syscap SystemCapability.ArkUI.ArkUI.Full 360 * @crossplatform 361 * @atomicservice 362 * @since arkts {'1.1':'18','1.2':'20'} 363 * @arkts 1.1&1.2 364 */ 365 footerContent?: ComponentContent; 366 367 /** 368 * Describes the water flow scroller. 369 * 370 * @type { ?Scroller } 371 * @syscap SystemCapability.ArkUI.ArkUI.Full 372 * @since 9 373 */ 374 /** 375 * Describes the water flow scroller. 376 * 377 * @type { ?Scroller } 378 * @syscap SystemCapability.ArkUI.ArkUI.Full 379 * @crossplatform 380 * @since 10 381 */ 382 /** 383 * Controller of the scrollable component, bound to the scrollable component. 384 * 385 * <p><strong>NOTE</strong> 386 * <br>The scroller cannot be bound to other scrollable components, such as ArcList, List, Grid, or Scroll. 387 * </p> 388 * 389 * @type { ?Scroller } 390 * @syscap SystemCapability.ArkUI.ArkUI.Full 391 * @crossplatform 392 * @atomicservice 393 * @since arkts {'1.1':'11','1.2':'20'} 394 * @arkts 1.1&1.2 395 */ 396 scroller?: Scroller; 397 398 /** 399 * Water flow item sections. Different sections can have different numbers of columns. 400 * 401 * <p><strong>NOTE</strong> 402 * <br>1. When <em>sections</em> is used, the <em>columnsTemplate</em> and <em>rowsTemplate</em> attributes are ignored. 403 * <br>2. When <em>sections</em> is used, the footer cannot be set separately. The last section can function as the footer. 404 * </p> 405 * 406 * @type { ?WaterFlowSections } sections - sections with different cross count 407 * @syscap SystemCapability.ArkUI.ArkUI.Full 408 * @crossplatform 409 * @atomicservice 410 * @since arkts {'1.1':'12','1.2':'20'} 411 * @arkts 1.1&1.2 412 */ 413 sections?: WaterFlowSections; 414 415 /** 416 * Layout mode of the <em>WaterFlow</em> component. 417 * 418 * @type { ?WaterFlowLayoutMode } 419 * @default ALWAYS_TOP_DOWN 420 * @syscap SystemCapability.ArkUI.ArkUI.Full 421 * @crossplatform 422 * @atomicservice 423 * @since arkts {'1.1':'12','1.2':'20'} 424 * @arkts 1.1&1.2 425 */ 426 layoutMode?: WaterFlowLayoutMode; 427} 428 429/** 430 * Defines a UIWaterFlowEvent which is used to set event to target component. 431 * 432 * @extends UIScrollableCommonEvent 433 * @interface UIWaterFlowEvent 434 * @syscap SystemCapability.ArkUI.ArkUI.Full 435 * @crossplatform 436 * @atomicservice 437 * @since 19 438 */ 439declare interface UIWaterFlowEvent extends UIScrollableCommonEvent { 440 /** 441 * Set or reset the callback which is triggered when the WaterFlow will scroll. 442 * 443 * @param { OnWillScrollCallback | undefined } callback - callback function, triggered when the WaterFlow will scroll. 444 * @syscap SystemCapability.ArkUI.ArkUI.Full 445 * @crossplatform 446 * @atomicservice 447 * @since 19 448 */ 449 setOnWillScroll(callback: OnWillScrollCallback | undefined): void; 450 451 /** 452 * Set or reset the callback which is triggered when WaterFlow view did scroll. 453 * 454 * @param { OnScrollCallback | undefined } callback - callback function, triggered when the WaterFlow did scroll. 455 * @syscap SystemCapability.ArkUI.ArkUI.Full 456 * @crossplatform 457 * @atomicservice 458 * @since 19 459 */ 460 setOnDidScroll(callback: OnScrollCallback | undefined): void; 461 462 /** 463 * Set or reset the callback which is triggered when the start and end positions of the display change. 464 * 465 * @param { OnWaterFlowScrollIndexCallback | undefined } callback - callback function, triggered when start or 466 * end positions of the display change. 467 * @syscap SystemCapability.ArkUI.ArkUI.Full 468 * @crossplatform 469 * @atomicservice 470 * @since 19 471 */ 472 setOnScrollIndex(callback: OnWaterFlowScrollIndexCallback | undefined): void; 473} 474 475/** 476 * Defines the callback type used in onScrollIndex. 477 * 478 * @typedef {function} OnWaterFlowScrollIndexCallback 479 * @param {number} first - the first index in visible content. 480 * @param {number} last - the last index in visible content. 481 * @syscap SystemCapability.ArkUI.ArkUI.Full 482 * @crossplatform 483 * @atomicservice 484 * @since 19 485 */ 486declare type OnWaterFlowScrollIndexCallback = (first: number, last: number) => void; 487 488/** 489 * Defines the water flow interface. 490 * 491 * @interface WaterFlowInterface 492 * @syscap SystemCapability.ArkUI.ArkUI.Full 493 * @since 9 494 */ 495/** 496 * Defines the water flow interface. 497 * 498 * @interface WaterFlowInterface 499 * @syscap SystemCapability.ArkUI.ArkUI.Full 500 * @crossplatform 501 * @since 10 502 */ 503/** 504 * Defines the water flow interface. 505 * 506 * @interface WaterFlowInterface 507 * @syscap SystemCapability.ArkUI.ArkUI.Full 508 * @crossplatform 509 * @atomicservice 510 * @since arkts {'1.1':'11','1.2':'20'} 511 * @arkts 1.1&1.2 512 */ 513interface WaterFlowInterface { 514 /** 515 * WaterFlow is returned when the parameter is transferred. Only support api: scrollToIndex 516 * 517 * @param { WaterFlowOptions } options 518 * @returns { WaterFlowAttribute } 519 * @syscap SystemCapability.ArkUI.ArkUI.Full 520 * @since 9 521 */ 522 /** 523 * WaterFlow is returned when the parameter is transferred. Only support api: scrollToIndex 524 * 525 * @param { WaterFlowOptions } options 526 * @returns { WaterFlowAttribute } 527 * @syscap SystemCapability.ArkUI.ArkUI.Full 528 * @crossplatform 529 * @since 10 530 */ 531 /** 532 * WaterFlow is returned when the parameter is transferred. Only support api: scrollToIndex 533 * 534 * @param { WaterFlowOptions } options 535 * @returns { WaterFlowAttribute } 536 * @syscap SystemCapability.ArkUI.ArkUI.Full 537 * @crossplatform 538 * @atomicservice 539 * @since arkts {'1.1':'11','1.2':'20'} 540 * @arkts 1.1&1.2 541 */ 542 (options?: WaterFlowOptions): WaterFlowAttribute; 543} 544 545/** 546 * Defines the water flow attribute. 547 * 548 * @extends CommonMethod<WaterFlowAttribute> 549 * @syscap SystemCapability.ArkUI.ArkUI.Full 550 * @since 9 551 */ 552/** 553 * Defines the water flow attribute. 554 * 555 * @extends CommonMethod<WaterFlowAttribute> 556 * @syscap SystemCapability.ArkUI.ArkUI.Full 557 * @crossplatform 558 * @since 10 559 */ 560/** 561 * Defines the water flow attribute. 562 * 563 * @extends ScrollableCommonMethod<WaterFlowAttribute> 564 * @syscap SystemCapability.ArkUI.ArkUI.Full 565 * @crossplatform 566 * @atomicservice 567 * @since arkts {'1.1':'11','1.2':'20'} 568 * @arkts 1.1&1.2 569 */ 570declare class WaterFlowAttribute extends ScrollableCommonMethod<WaterFlowAttribute> { 571 /** 572 * This parameter specifies the number of columns in the current waterflow. 573 * 574 * @param { string } value 575 * @returns { WaterFlowAttribute } 576 * @syscap SystemCapability.ArkUI.ArkUI.Full 577 * @since 9 578 */ 579 /** 580 * This parameter specifies the number of columns in the current waterflow. 581 * 582 * @param { string } value 583 * @returns { WaterFlowAttribute } 584 * @syscap SystemCapability.ArkUI.ArkUI.Full 585 * @crossplatform 586 * @since 10 587 */ 588 /** 589 * Sets the number of columns in the layout. If this attribute is not set, one column is used by default. 590 * 591 * @param { string } value - Number of columns in the layout.<br>Default value: <em>'1fr'</em> 592 * @returns { WaterFlowAttribute } 593 * @syscap SystemCapability.ArkUI.ArkUI.Full 594 * @crossplatform 595 * @atomicservice 596 * @since arkts {'1.1':'11','1.2':'20'} 597 * @arkts 1.1&1.2 598 */ 599 columnsTemplate(value: string): WaterFlowAttribute; 600 601 /** 602 * This parameter specifies the min or max size of each item. 603 * 604 * @param { ConstraintSizeOptions } value 605 * @returns { WaterFlowAttribute } 606 * @syscap SystemCapability.ArkUI.ArkUI.Full 607 * @since 9 608 */ 609 /** 610 * This parameter specifies the min or max size of each item. 611 * 612 * @param { ConstraintSizeOptions } value 613 * @returns { WaterFlowAttribute } 614 * @syscap SystemCapability.ArkUI.ArkUI.Full 615 * @crossplatform 616 * @since 10 617 */ 618 /** 619 * Sets the size constraints of the child components during layout. 620 * 621 * @param { ConstraintSizeOptions } value - Size constraints of the child components during layout. 622 * If the value specified is less than 0, this parameter does not take effect. 623 * @returns { WaterFlowAttribute } 624 * @syscap SystemCapability.ArkUI.ArkUI.Full 625 * @crossplatform 626 * @atomicservice 627 * @since arkts {'1.1':'11','1.2':'20'} 628 * @arkts 1.1&1.2 629 */ 630 itemConstraintSize(value: ConstraintSizeOptions): WaterFlowAttribute; 631 632 /** 633 * Set the number of rows in the current waterflow. 634 * 635 * @param { string } value 636 * @returns { WaterFlowAttribute } 637 * @syscap SystemCapability.ArkUI.ArkUI.Full 638 * @since 9 639 */ 640 /** 641 * Set the number of rows in the current waterflow. 642 * 643 * @param { string } value 644 * @returns { WaterFlowAttribute } 645 * @syscap SystemCapability.ArkUI.ArkUI.Full 646 * @crossplatform 647 * @since 10 648 */ 649 /** 650 * Sets the number of rows in the layout. If this attribute is not set, one row is used by default. 651 * 652 * @param { string } value - Number of rows in the layout.<br>Default value: <em>'1fr'</em> 653 * @returns { WaterFlowAttribute } 654 * @syscap SystemCapability.ArkUI.ArkUI.Full 655 * @crossplatform 656 * @atomicservice 657 * @since arkts {'1.1':'11','1.2':'20'} 658 * @arkts 1.1&1.2 659 */ 660 rowsTemplate(value: string): WaterFlowAttribute; 661 662 /** 663 * Set the spacing between columns. 664 * 665 * @param { Length } value 666 * @returns { WaterFlowAttribute } 667 * @syscap SystemCapability.ArkUI.ArkUI.Full 668 * @since 9 669 */ 670 /** 671 * Set the spacing between columns. 672 * 673 * @param { Length } value 674 * @returns { WaterFlowAttribute } 675 * @syscap SystemCapability.ArkUI.ArkUI.Full 676 * @crossplatform 677 * @since 10 678 */ 679 /** 680 * Sets the gap between columns. 681 * 682 * @param { Length } value - Gap between columns.<br>Default value: <em>0</em> 683 * <br>Value range: [0, +∞). 684 * @returns { WaterFlowAttribute } 685 * @syscap SystemCapability.ArkUI.ArkUI.Full 686 * @crossplatform 687 * @atomicservice 688 * @since arkts {'1.1':'11','1.2':'20'} 689 * @arkts 1.1&1.2 690 */ 691 columnsGap(value: Length): WaterFlowAttribute; 692 693 /** 694 * Set the spacing between rows. 695 * 696 * @param { Length } value 697 * @returns { WaterFlowAttribute } 698 * @syscap SystemCapability.ArkUI.ArkUI.Full 699 * @since 9 700 */ 701 /** 702 * Set the spacing between rows. 703 * 704 * @param { Length } value 705 * @returns { WaterFlowAttribute } 706 * @syscap SystemCapability.ArkUI.ArkUI.Full 707 * @crossplatform 708 * @since 10 709 */ 710 /** 711 * Sets the gap between rows. 712 * 713 * @param { Length } value - Gap between rows.<br>Default value: <em>0</em> 714 * @returns { WaterFlowAttribute } 715 * @syscap SystemCapability.ArkUI.ArkUI.Full 716 * @crossplatform 717 * @atomicservice 718 * @since arkts {'1.1':'11','1.2':'20'} 719 * @arkts 1.1&1.2 720 */ 721 rowsGap(value: Length): WaterFlowAttribute; 722 723 /** 724 * Control layout direction of the WaterFlow. 725 * 726 * @param { FlexDirection } value 727 * @returns { WaterFlowAttribute } 728 * @syscap SystemCapability.ArkUI.ArkUI.Full 729 * @since 9 730 */ 731 /** 732 * Control layout direction of the WaterFlow. 733 * 734 * @param { FlexDirection } value 735 * @returns { WaterFlowAttribute } 736 * @syscap SystemCapability.ArkUI.ArkUI.Full 737 * @crossplatform 738 * @since 10 739 */ 740 /** 741 * Sets the main axis direction of the layout. 742 * 743 * @param { FlexDirection } value - Main axis direction of the layout.<br>Default value: <em>FlexDirection.Column</em> 744 * @returns { WaterFlowAttribute } 745 * @syscap SystemCapability.ArkUI.ArkUI.Full 746 * @crossplatform 747 * @atomicservice 748 * @since arkts {'1.1':'11','1.2':'20'} 749 * @arkts 1.1&1.2 750 */ 751 layoutDirection(value: FlexDirection): WaterFlowAttribute; 752 753 /** 754 * Called to setting the nested scroll options. 755 * 756 * @param { NestedScrollOptions } value - options for nested scrolling. 757 * @returns { WaterFlowAttribute } the attribute of the water flow. 758 * @syscap SystemCapability.ArkUI.ArkUI.Full 759 * @since 10 760 */ 761 /** 762 * Sets the nested scrolling mode in the forward and backward directions to implement scrolling linkage with the parent component. 763 * 764 * @param { NestedScrollOptions } value - Nested scrolling options. 765 * @returns { WaterFlowAttribute } the attribute of the water flow. 766 * @syscap SystemCapability.ArkUI.ArkUI.Full 767 * @crossplatform 768 * @atomicservice 769 * @since 11 770 */ 771 nestedScroll(value: NestedScrollOptions): WaterFlowAttribute; 772 773 /** 774 * Called when setting whether to enable scroll by gesture or mouse. 775 * @param { boolean } value 776 * @returns { WaterFlowAttribute } The attribute of the waterflow 777 * @syscap SystemCapability.ArkUI.ArkUI.Full 778 * @crossplatform 779 * @since 10 780 */ 781 /** 782 * Sets whether to support scroll gestures. 783 * 784 * @param { boolean } value - Whether to support scroll gestures.<br>Default value: <em>true</em> 785 * @returns { WaterFlowAttribute } The attribute of the waterflow 786 * @syscap SystemCapability.ArkUI.ArkUI.Full 787 * @crossplatform 788 * @atomicservice 789 * @since 11 790 */ 791 enableScrollInteraction(value: boolean): WaterFlowAttribute; 792 793 /** 794 * Called to setting the friction. 795 * @param { number | Resource } value - options for scrolling friction. 796 * @returns { WaterFlowAttribute } the attribute of the water flow. 797 * @syscap SystemCapability.ArkUI.ArkUI.Full 798 * @crossplatform 799 * @since 10 800 */ 801 /** 802 * Sets the friction coefficient. It applies only to gestures in the scrolling area, 803 * and it affects only indirectly the scroll chaining during the inertial scrolling process. 804 * 805 * @param { number | Resource } value - Friction coefficient.<br>Default value: <em>0.9</em> for wearable devices and <em>0.6</em> for non-wearable devices. 806 * <br>Since API version 11, the default value for non-wearable devices is <em>0.7</em>. 807 * <br>Since API version 12, the default value for non-wearable devices is <em>0.75</em>. 808 * <br>Value range: (0, +∞). 809 * <br>If the value is less than or equal to 0, the default value is used. 810 * @returns { WaterFlowAttribute } the attribute of the water flow. 811 * @syscap SystemCapability.ArkUI.ArkUI.Full 812 * @crossplatform 813 * @atomicservice 814 * @since 11 815 */ 816 friction(value: number | Resource): WaterFlowAttribute; 817 818 /** 819 * Called to set number of flow items to be preloaded (cached) in LazyForEach. 820 * @param { number } value - number of flow items to be preloaded (cached). 821 * @returns { WaterFlowAttribute } the attribute of the water flow. 822 * @syscap SystemCapability.ArkUI.ArkUI.Full 823 * @crossplatform 824 * @since 11 825 */ 826 /** 827 * Sets the number of items to be cached. 828 * 829 * @param { number } value - Number of water flow items to be preloaded (cached). 830 * <br>Default value: number of nodes visible on the screen, with the maximum value of 16 831 * <br>Value range: [0, +∞). 832 * <br>Values less than 0 are treated as <em>1</em>. 833 * @returns { WaterFlowAttribute } the attribute of the water flow. 834 * @syscap SystemCapability.ArkUI.ArkUI.Full 835 * @crossplatform 836 * @atomicservice 837 * @since arkts {'1.1':'12','1.2':'20'} 838 * @arkts 1.1&1.2 839 */ 840 cachedCount(value: number): WaterFlowAttribute; 841 842 /** 843 * Sets the number of water flow items to be cached (preloaded) and specifies whether to display the cached nodes. 844 * 845 * @param { number } count - Number of water flow items to be preloaded (cached). 846 * <br>Default value: number of nodes visible on the screen, with the maximum value of 16 847 * <br>Value range: [0, +∞). 848 * <br>Values less than 0 are treated as <em>1</em>. 849 * @param { boolean } show - Whether to display the cached water flow items. 850 * @returns { WaterFlowAttribute } the attribute of the water flow. 851 * @syscap SystemCapability.ArkUI.ArkUI.Full 852 * @crossplatform 853 * @atomicservice 854 * @since arkts {'1.1':'14','1.2':'20'} 855 * @arkts 1.1&1.2 856 */ 857 cachedCount(count: number, show: boolean): WaterFlowAttribute; 858 859 /** 860 * Set whether to synchronously load child nodes within one frame. 861 * 862 * @param { boolean } enable - Whether to synchronously load child nodes within one frame 863 * @returns { WaterFlowAttribute } The attribute of the water flow. 864 * @syscap SystemCapability.ArkUI.ArkUI.Full 865 * @crossplatform 866 * @atomicservice 867 * @since 20 868 */ 869 syncLoad(enable: boolean): WaterFlowAttribute; 870 871 /** 872 * Called when the water flow begins to arrive. 873 * 874 * @param { function } event 875 * @returns { WaterFlowAttribute } 876 * @syscap SystemCapability.ArkUI.ArkUI.Full 877 * @since 9 878 */ 879 /** 880 * Called when the water flow begins to arrive. 881 * 882 * @param { function } event 883 * @returns { WaterFlowAttribute } 884 * @syscap SystemCapability.ArkUI.ArkUI.Full 885 * @crossplatform 886 * @since 10 887 */ 888 /** 889 * Triggered when the component reaches the start. 890 * 891 * @param { function } event 892 * @returns { WaterFlowAttribute } 893 * @syscap SystemCapability.ArkUI.ArkUI.Full 894 * @crossplatform 895 * @atomicservice 896 * @since 11 897 */ 898 onReachStart(event: () => void): WaterFlowAttribute; 899 900 /** 901 * Called when the water flow reaches the end. 902 * 903 * @param { function } event 904 * @returns { WaterFlowAttribute } 905 * @syscap SystemCapability.ArkUI.ArkUI.Full 906 * @since 9 907 */ 908 /** 909 * Called when the water flow reaches the end. 910 * 911 * @param { function } event 912 * @returns { WaterFlowAttribute } 913 * @syscap SystemCapability.ArkUI.ArkUI.Full 914 * @crossplatform 915 * @since 10 916 */ 917 /** 918 * Triggered when the component reaches the end position. 919 * 920 * @param { function } event 921 * @returns { WaterFlowAttribute } 922 * @syscap SystemCapability.ArkUI.ArkUI.Full 923 * @crossplatform 924 * @atomicservice 925 * @since 11 926 */ 927 onReachEnd(event: () => void): WaterFlowAttribute; 928 929 /** 930 * Called when scrolling begin each frame. 931 * 932 * @param { function } event 933 * @returns { WaterFlowAttribute } the attribute of the water flow. 934 * @syscap SystemCapability.ArkUI.ArkUI.Full 935 * @crossplatform 936 * @since 10 937 */ 938 /** 939 * Triggered when the component starts to scroll. 940 * 941 * @param { function } event 942 * @returns { WaterFlowAttribute } the attribute of the water flow. 943 * @syscap SystemCapability.ArkUI.ArkUI.Full 944 * @crossplatform 945 * @atomicservice 946 * @since 11 947 */ 948 /** 949 * Called when scrolling begin each frame. 950 * Anonymous Object Rectification. 951 * 952 * @param { OnScrollFrameBeginCallback } event - callback function, triggered when the scrolling begin each frame. 953 * @returns { WaterFlowAttribute } the attribute of the water flow. 954 * @syscap SystemCapability.ArkUI.ArkUI.Full 955 * @crossplatform 956 * @atomicservice 957 * @since 20 958 */ 959 onScrollFrameBegin(event: OnScrollFrameBeginCallback): WaterFlowAttribute; 960 961 /** 962 * Called when scrolling begin each frame. 963 * Anonymous Object Rectification. 964 * 965 * @param { OnScrollFrameBeginCallback } event - callback function, triggered when the scrolling begin each frame. 966 * @returns { WaterFlowAttribute } the attribute of the water flow. 967 * @syscap SystemCapability.ArkUI.ArkUI.Full 968 * @crossplatform 969 * @atomicservice 970 * @since 20 971 * @arkts 1.2 972 */ 973 onScrollFrameBegin(event: OnScrollFrameBeginCallback): WaterFlowAttribute; 974 975 /** 976 * Triggered when the first or last item displayed in the component changes. 977 * It is triggered once when the component is initialized. 978 * 979 * @param { function } event - Callback function, triggered when the first or last item 980 * displayed in the waterflow changes. 981 * "first": the index of the first item displayed in the waterflow, 982 * "last": the index of the last item displayed in the waterflow. 983 * @returns { WaterFlowAttribute } the attribute of the water flow. 984 * @syscap SystemCapability.ArkUI.ArkUI.Full 985 * @crossplatform 986 * @atomicservice 987 * @since arkts {'1.1':'11','1.2':'20'} 988 * @arkts 1.1&1.2 989 */ 990 onScrollIndex(event: (first: number, last: number) => void): WaterFlowAttribute; 991 992 /** 993 * Called when the scrollable will scroll. 994 * 995 * @param { Optional<OnWillScrollCallback> } handler - callback of scrollable. 996 * @returns { WaterFlowAttribute } 997 * @syscap SystemCapability.ArkUI.ArkUI.Full 998 * @atomicservice 999 * @since 20 1000 * @arkts 1.2 1001 */ 1002 onWillScroll(handler: Optional<OnWillScrollCallback>): WaterFlowAttribute; 1003 1004 /** 1005 * Called when the scrollable did scroll. 1006 * 1007 * @param { OnScrollCallback } handler - callback of scrollable, 1008 * scrollOffset is offset this frame did scroll, scrollState is current scroll state. 1009 * @returns { WaterFlowAttribute } 1010 * @syscap SystemCapability.ArkUI.ArkUI.Full 1011 * @atomicservice 1012 * @since 20 1013 * @arkts 1.2 1014 */ 1015 onDidScroll(handler: OnScrollCallback): WaterFlowAttribute; 1016} 1017 1018/** 1019 * Defines WaterFlow Component. 1020 * 1021 * @syscap SystemCapability.ArkUI.ArkUI.Full 1022 * @since 9 1023 */ 1024/** 1025 * Defines WaterFlow Component. 1026 * 1027 * @syscap SystemCapability.ArkUI.ArkUI.Full 1028 * @crossplatform 1029 * @since 10 1030 */ 1031/** 1032 * Defines WaterFlow Component. 1033 * 1034 * @syscap SystemCapability.ArkUI.ArkUI.Full 1035 * @crossplatform 1036 * @atomicservice 1037 * @since 11 1038 */ 1039/** 1040 * Defines WaterFlow Component. 1041 * It is recommended to use LazyForEach or Repeat to generate child components. 1042 * 1043 * @syscap SystemCapability.ArkUI.ArkUI.Full 1044 * @crossplatform 1045 * @atomicservice 1046 * @since 20 1047 */ 1048declare const WaterFlow: WaterFlowInterface; 1049 1050/** 1051 * Defines WaterFlow Component instance. 1052 * 1053 * @syscap SystemCapability.ArkUI.ArkUI.Full 1054 * @since 9 1055 */ 1056/** 1057 * Defines WaterFlow Component instance. 1058 * 1059 * @syscap SystemCapability.ArkUI.ArkUI.Full 1060 * @crossplatform 1061 * @since 10 1062 */ 1063/** 1064 * Defines WaterFlow Component instance. 1065 * 1066 * @syscap SystemCapability.ArkUI.ArkUI.Full 1067 * @crossplatform 1068 * @atomicservice 1069 * @since 11 1070 */ 1071declare const WaterFlowInstance: WaterFlowAttribute; 1072