1/* 2 * Copyright (c) 2022-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 * Defines the water flow options. 18 * 19 * @interface WaterFlowOptions 20 * @syscap SystemCapability.ArkUI.ArkUI.Full 21 * @since 9 22 */ 23/** 24 * Defines the water flow options. 25 * 26 * @interface WaterFlowOptions 27 * @syscap SystemCapability.ArkUI.ArkUI.Full 28 * @crossplatform 29 * @since 10 30 */ 31declare interface WaterFlowOptions { 32 /** 33 * Describes the water flow footer. 34 * 35 * @type { ?CustomBuilder } 36 * @syscap SystemCapability.ArkUI.ArkUI.Full 37 * @since 9 38 */ 39 /** 40 * Describes the water flow footer. 41 * 42 * @type { ?CustomBuilder } 43 * @syscap SystemCapability.ArkUI.ArkUI.Full 44 * @crossplatform 45 * @since 10 46 */ 47 footer?: CustomBuilder; 48 49 /** 50 * Describes the water flow scroller. 51 * 52 * @type { ?Scroller } 53 * @syscap SystemCapability.ArkUI.ArkUI.Full 54 * @since 9 55 */ 56 /** 57 * Describes the water flow scroller. 58 * 59 * @type { ?Scroller } 60 * @syscap SystemCapability.ArkUI.ArkUI.Full 61 * @crossplatform 62 * @since 10 63 */ 64 scroller?: Scroller; 65} 66 67/** 68 * Defines the water flow interface. 69 * 70 * @interface WaterFlowInterface 71 * @syscap SystemCapability.ArkUI.ArkUI.Full 72 * @since 9 73 */ 74/** 75 * Defines the water flow interface. 76 * 77 * @interface WaterFlowInterface 78 * @syscap SystemCapability.ArkUI.ArkUI.Full 79 * @crossplatform 80 * @since 10 81 */ 82interface WaterFlowInterface { 83 /** 84 * WaterFlow is returned when the parameter is transferred. Only support api: scrollToIndex 85 * 86 * @param { WaterFlowOptions } options 87 * @returns { WaterFlowAttribute } 88 * @syscap SystemCapability.ArkUI.ArkUI.Full 89 * @since 9 90 */ 91 /** 92 * WaterFlow is returned when the parameter is transferred. Only support api: scrollToIndex 93 * 94 * @param { WaterFlowOptions } options 95 * @returns { WaterFlowAttribute } 96 * @syscap SystemCapability.ArkUI.ArkUI.Full 97 * @crossplatform 98 * @since 10 99 */ 100 (options?: WaterFlowOptions): WaterFlowAttribute; 101} 102 103/** 104 * Defines the water flow attribute. 105 * 106 * @extends CommonMethod 107 * @syscap SystemCapability.ArkUI.ArkUI.Full 108 * @since 9 109 */ 110/** 111 * Defines the water flow attribute. 112 * 113 * @extends CommonMethod 114 * @syscap SystemCapability.ArkUI.ArkUI.Full 115 * @crossplatform 116 * @since 10 117 */ 118declare class WaterFlowAttribute extends CommonMethod<WaterFlowAttribute> { 119 /** 120 * This parameter specifies the number of columns in the current waterflow. 121 * 122 * @param { string } value 123 * @returns { WaterFlowAttribute } 124 * @syscap SystemCapability.ArkUI.ArkUI.Full 125 * @since 9 126 */ 127 /** 128 * This parameter specifies the number of columns in the current waterflow. 129 * 130 * @param { string } value 131 * @returns { WaterFlowAttribute } 132 * @syscap SystemCapability.ArkUI.ArkUI.Full 133 * @crossplatform 134 * @since 10 135 */ 136 columnsTemplate(value: string): WaterFlowAttribute; 137 138 /** 139 * This parameter specifies the min or max size of each item. 140 * 141 * @param { ConstraintSizeOptions } value 142 * @returns { WaterFlowAttribute } 143 * @syscap SystemCapability.ArkUI.ArkUI.Full 144 * @since 9 145 */ 146 /** 147 * This parameter specifies the min or max size of each item. 148 * 149 * @param { ConstraintSizeOptions } value 150 * @returns { WaterFlowAttribute } 151 * @syscap SystemCapability.ArkUI.ArkUI.Full 152 * @crossplatform 153 * @since 10 154 */ 155 itemConstraintSize(value: ConstraintSizeOptions): WaterFlowAttribute; 156 157 /** 158 * Set the number of rows in the current waterflow. 159 * 160 * @param { string } value 161 * @returns { WaterFlowAttribute } 162 * @syscap SystemCapability.ArkUI.ArkUI.Full 163 * @since 9 164 */ 165 /** 166 * Set the number of rows in the current waterflow. 167 * 168 * @param { string } value 169 * @returns { WaterFlowAttribute } 170 * @syscap SystemCapability.ArkUI.ArkUI.Full 171 * @crossplatform 172 * @since 10 173 */ 174 rowsTemplate(value: string): WaterFlowAttribute; 175 176 /** 177 * Set the spacing between columns. 178 * 179 * @param { Length } value 180 * @returns { WaterFlowAttribute } 181 * @syscap SystemCapability.ArkUI.ArkUI.Full 182 * @since 9 183 */ 184 /** 185 * Set the spacing between columns. 186 * 187 * @param { Length } value 188 * @returns { WaterFlowAttribute } 189 * @syscap SystemCapability.ArkUI.ArkUI.Full 190 * @crossplatform 191 * @since 10 192 */ 193 columnsGap(value: Length): WaterFlowAttribute; 194 195 /** 196 * Set the spacing between rows. 197 * 198 * @param { Length } value 199 * @returns { WaterFlowAttribute } 200 * @syscap SystemCapability.ArkUI.ArkUI.Full 201 * @since 9 202 */ 203 /** 204 * Set the spacing between rows. 205 * 206 * @param { Length } value 207 * @returns { WaterFlowAttribute } 208 * @syscap SystemCapability.ArkUI.ArkUI.Full 209 * @crossplatform 210 * @since 10 211 */ 212 rowsGap(value: Length): WaterFlowAttribute; 213 214 /** 215 * Control layout direction of the WaterFlow. 216 * 217 * @param { FlexDirection } value 218 * @returns { WaterFlowAttribute } 219 * @syscap SystemCapability.ArkUI.ArkUI.Full 220 * @since 9 221 */ 222 /** 223 * Control layout direction of the WaterFlow. 224 * 225 * @param { FlexDirection } value 226 * @returns { WaterFlowAttribute } 227 * @syscap SystemCapability.ArkUI.ArkUI.Full 228 * @crossplatform 229 * @since 10 230 */ 231 layoutDirection(value: FlexDirection): WaterFlowAttribute; 232 233 234 /** 235 * Called to setting the nested scroll options. 236 * 237 * @param { NestedScrollOptions } value - options for nested scrolling. 238 * @returns { WaterFlowAttribute } the attribute of the water flow. 239 * @syscap SystemCapability.ArkUI.ArkUI.Full 240 * @since 10 241 */ 242 nestedScroll(value: NestedScrollOptions): WaterFlowAttribute; 243 244 /** 245 * Called when setting whether to enable scroll by gesture or mouse. 246 * @param { boolean } value 247 * @returns { WaterFlowAttribute } The attribute of the waterflow 248 * @syscap SystemCapability.ArkUI.ArkUI.Full 249 * @crossplatform 250 * @since 10 251 */ 252 enableScrollInteraction(value: boolean): WaterFlowAttribute; 253 254 /** 255 * Called to setting the friction. 256 * @param { number | Resource } value - options for scrolling friction. 257 * @returns { WaterFlowAttribute } the attribute of the water flow. 258 * @syscap SystemCapability.ArkUI.ArkUI.Full 259 * @crossplatform 260 * @since 10 261 */ 262 friction(value: number | Resource): WaterFlowAttribute; 263 264 /** 265 * Called when the water flow begins to arrive. 266 * 267 * @param { function } event 268 * @returns { WaterFlowAttribute } 269 * @syscap SystemCapability.ArkUI.ArkUI.Full 270 * @since 9 271 */ 272 /** 273 * Called when the water flow begins to arrive. 274 * 275 * @param { function } event 276 * @returns { WaterFlowAttribute } 277 * @syscap SystemCapability.ArkUI.ArkUI.Full 278 * @crossplatform 279 * @since 10 280 */ 281 onReachStart(event: () => void): WaterFlowAttribute; 282 283 /** 284 * Called when the water flow reaches the end. 285 * 286 * @param { function } event 287 * @returns { WaterFlowAttribute } 288 * @syscap SystemCapability.ArkUI.ArkUI.Full 289 * @since 9 290 */ 291 /** 292 * Called when the water flow reaches the end. 293 * 294 * @param { function } event 295 * @returns { WaterFlowAttribute } 296 * @syscap SystemCapability.ArkUI.ArkUI.Full 297 * @crossplatform 298 * @since 10 299 */ 300 onReachEnd(event: () => void): WaterFlowAttribute; 301 302 /** 303 * Called when scrolling begin each frame. 304 * 305 * @param { function } event 306 * @returns { WaterFlowAttribute } the attribute of the water flow. 307 * @syscap SystemCapability.ArkUI.ArkUI.Full 308 * @crossplatform 309 * @since 10 310 */ 311 onScrollFrameBegin(event: (offset: number, state: ScrollState) => { offsetRemain: number }): WaterFlowAttribute; 312} 313 314/** 315 * Defines WaterFlow Component. 316 * 317 * @syscap SystemCapability.ArkUI.ArkUI.Full 318 * @since 9 319 */ 320/** 321 * Defines WaterFlow Component. 322 * 323 * @syscap SystemCapability.ArkUI.ArkUI.Full 324 * @crossplatform 325 * @since 10 326 */ 327declare const WaterFlow: WaterFlowInterface; 328 329/** 330 * Defines WaterFlow Component instance. 331 * 332 * @syscap SystemCapability.ArkUI.ArkUI.Full 333 * @since 9 334 */ 335/** 336 * Defines WaterFlow Component instance. 337 * 338 * @syscap SystemCapability.ArkUI.ArkUI.Full 339 * @crossplatform 340 * @since 10 341 */ 342declare const WaterFlowInstance: WaterFlowAttribute; 343