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 refresh status of the drop-down refresh. 18 * 19 * @enum { number } 20 * @syscap SystemCapability.ArkUI.ArkUI.Full 21 * @since 8 22 */ 23/** 24 * The refresh status of the drop-down refresh. 25 * 26 * @enum { number } 27 * @syscap SystemCapability.ArkUI.ArkUI.Full 28 * @crossplatform 29 * @since 10 30 */ 31declare enum RefreshStatus { 32 /** 33 * The refresh status of the drop-down refresh. 34 * 35 * @syscap SystemCapability.ArkUI.ArkUI.Full 36 * @since 8 37 */ 38 /** 39 * The refresh status of the drop-down refresh. 40 * 41 * @syscap SystemCapability.ArkUI.ArkUI.Full 42 * @crossplatform 43 * @since 10 44 */ 45 Inactive, 46 47 /** 48 * Drop down, but the drop-down distance is less than the refresh distance. 49 * 50 * @syscap SystemCapability.ArkUI.ArkUI.Full 51 * @since 8 52 */ 53 /** 54 * Drop down, but the drop-down distance is less than the refresh distance. 55 * 56 * @syscap SystemCapability.ArkUI.ArkUI.Full 57 * @crossplatform 58 * @since 10 59 */ 60 Drag, 61 62 /** 63 * The pull-down exceeds the refresh distance. 64 * 65 * @syscap SystemCapability.ArkUI.ArkUI.Full 66 * @since 8 67 */ 68 /** 69 * The pull-down exceeds the refresh distance. 70 * 71 * @syscap SystemCapability.ArkUI.ArkUI.Full 72 * @crossplatform 73 * @since 10 74 */ 75 OverDrag, 76 77 /** 78 * After the pull-down, it rebounds to the refresh distance and enters the refresh state. 79 * 80 * @syscap SystemCapability.ArkUI.ArkUI.Full 81 * @since 8 82 */ 83 /** 84 * After the pull-down, it rebounds to the refresh distance and enters the refresh state. 85 * 86 * @syscap SystemCapability.ArkUI.ArkUI.Full 87 * @crossplatform 88 * @since 10 89 */ 90 Refresh, 91 92 /** 93 * After refresh, return to the initial state. 94 * 95 * @syscap SystemCapability.ArkUI.ArkUI.Full 96 * @since 8 97 */ 98 /** 99 * After refresh, return to the initial state. 100 * 101 * @syscap SystemCapability.ArkUI.ArkUI.Full 102 * @crossplatform 103 * @since 10 104 */ 105 Done, 106} 107 108/** 109 * Defines the options of refresh component. 110 * 111 * @interface RefreshOptions 112 * @syscap SystemCapability.ArkUI.ArkUI.Full 113 * @since 8 114 */ 115/** 116 * Defines the options of refresh component. 117 * 118 * @interface RefreshOptions 119 * @syscap SystemCapability.ArkUI.ArkUI.Full 120 * @crossplatform 121 * @since 10 122 */ 123interface RefreshOptions { 124 /** 125 * Whether the current component is being refreshed. 126 * This parameter supports $$ for two-way binding of variables. 127 * 128 * @type { boolean } 129 * @syscap SystemCapability.ArkUI.ArkUI.Full 130 * @since 8 131 */ 132 /** 133 * Whether the current component is being refreshed. 134 * This parameter supports $$ for two-way binding of variables. 135 * 136 * @type { boolean } 137 * @syscap SystemCapability.ArkUI.ArkUI.Full 138 * @crossplatform 139 * @since 10 140 */ 141 refreshing: boolean; 142 143 /** 144 * Distance to the top of the parent component from the component that 145 * comes to rest after a successful pull-down gesture. Default value: 16, in vp 146 * 147 * @type { ?(number | string) } 148 * @syscap SystemCapability.ArkUI.ArkUI.Full 149 * @since 8 150 */ 151 /** 152 * Distance to the top of the parent component from the component that 153 * comes to rest after a successful pull-down gesture. Default value: 16, in vp 154 * 155 * @type { ?(number | string) } 156 * @syscap SystemCapability.ArkUI.ArkUI.Full 157 * @crossplatform 158 * @since 10 159 */ 160 offset?: number | string; 161 162 /** 163 * Coefficient of friction, which indicates the component's sensitivity to the pull-down gesture. 164 * The value ranges from 0 to 100. Default value: 62 165 * - 0 indicates that the component is not sensitive to the pull-down gesture. 166 * - 100 indicates that the component is highly sensitive to the pull-down gesture. 167 * - A larger value indicates a more sensitive response of the component to the pull-down gesture. 168 * 169 * @type { ?(number | string) } 170 * @syscap SystemCapability.ArkUI.ArkUI.Full 171 * @since 8 172 */ 173 /** 174 * Coefficient of friction, which indicates the component's sensitivity to the pull-down gesture. 175 * The value ranges from 0 to 100. Default value: 62 176 * - 0 indicates that the component is not sensitive to the pull-down gesture. 177 * - 100 indicates that the component is highly sensitive to the pull-down gesture. 178 * - A larger value indicates a more sensitive response of the component to the pull-down gesture. 179 * 180 * @type { ?(number | string) } 181 * @syscap SystemCapability.ArkUI.ArkUI.Full 182 * @crossplatform 183 * @since 10 184 */ 185 friction?: number | string; 186 187 /** 188 * Custom component to display during dragging. 189 * 190 * @type { ?CustomBuilder } 191 * @syscap SystemCapability.ArkUI.ArkUI.Full 192 * @crossplatform 193 * @since 10 194 */ 195 builder?: CustomBuilder; 196} 197 198/** 199 * Provides a pull-down refresh interface. 200 * 201 * @interface RefreshInterface 202 * @syscap SystemCapability.ArkUI.ArkUI.Full 203 * @since 8 204 */ 205/** 206 * Provides a pull-down refresh interface. 207 * 208 * @interface RefreshInterface 209 * @syscap SystemCapability.ArkUI.ArkUI.Full 210 * @crossplatform 211 * @since 10 212 */ 213interface RefreshInterface { 214 /** 215 * Called when the drop-down refresh is set. 216 * 217 * @param { RefreshOptions } value - The options of refresh component. 218 * @returns { RefreshAttribute } 219 * @syscap SystemCapability.ArkUI.ArkUI.Full 220 * @since 8 221 */ 222 /** 223 * Called when the drop-down refresh is set. 224 * 225 * @param { RefreshOptions } value - The options of refresh component. 226 * @returns { RefreshAttribute } 227 * @syscap SystemCapability.ArkUI.ArkUI.Full 228 * @crossplatform 229 * @since 10 230 */ 231 (value: RefreshOptions): RefreshAttribute; 232} 233 234/** 235 * Defines the refresh attribute functions. 236 * 237 * @extends CommonMethod 238 * @syscap SystemCapability.ArkUI.ArkUI.Full 239 * @since 8 240 */ 241/** 242 * Defines the refresh attribute functions. 243 * 244 * @extends CommonMethod 245 * @syscap SystemCapability.ArkUI.ArkUI.Full 246 * @crossplatform 247 * @since 10 248 */ 249declare class RefreshAttribute extends CommonMethod<RefreshAttribute> { 250 /** 251 * Called when the refresh state changes. 252 * 253 * @param { function } callback 254 * @returns { RefreshAttribute } 255 * @syscap SystemCapability.ArkUI.ArkUI.Full 256 * @since 8 257 */ 258 /** 259 * Called when the refresh state changes. 260 * 261 * @param { function } callback 262 * @returns { RefreshAttribute } 263 * @syscap SystemCapability.ArkUI.ArkUI.Full 264 * @crossplatform 265 * @since 10 266 */ 267 onStateChange(callback: (state: RefreshStatus) => void): RefreshAttribute; 268 269 /** 270 * Called when the refresh state is entered. 271 * 272 * @param { function } callback 273 * @returns { RefreshAttribute } 274 * @syscap SystemCapability.ArkUI.ArkUI.Full 275 * @since 8 276 */ 277 /** 278 * Called when the refresh state is entered. 279 * 280 * @param { function } callback 281 * @returns { RefreshAttribute } 282 * @syscap SystemCapability.ArkUI.ArkUI.Full 283 * @crossplatform 284 * @since 10 285 */ 286 onRefreshing(callback: () => void): RefreshAttribute; 287} 288 289/** 290 * Defines Refresh Component. 291 * 292 * @syscap SystemCapability.ArkUI.ArkUI.Full 293 * @since 8 294 */ 295/** 296 * Defines Refresh Component. 297 * 298 * @syscap SystemCapability.ArkUI.ArkUI.Full 299 * @crossplatform 300 * @since 10 301 */ 302declare const Refresh: RefreshInterface; 303 304/** 305 * Defines Refresh Component instance. 306 * 307 * @syscap SystemCapability.ArkUI.ArkUI.Full 308 * @since 8 309 */ 310/** 311 * Defines Refresh Component instance. 312 * 313 * @syscap SystemCapability.ArkUI.ArkUI.Full 314 * @crossplatform 315 * @since 10 316 */ 317declare const RefreshInstance: RefreshAttribute;