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 * Provides the interface for scoring bars. 23 * 24 * @interface RatingInterface 25 * @syscap SystemCapability.ArkUI.ArkUI.Full 26 * @since 7 27 */ 28/** 29 * Provides the interface for scoring bars. 30 * 31 * @interface RatingInterface 32 * @syscap SystemCapability.ArkUI.ArkUI.Full 33 * @form 34 * @since 9 35 */ 36/** 37 * Provides the interface for scoring bars. 38 * 39 * @interface RatingInterface 40 * @syscap SystemCapability.ArkUI.ArkUI.Full 41 * @crossplatform 42 * @form 43 * @since 10 44 */ 45/** 46 * Provides the interface for scoring bars. 47 * 48 * @interface RatingInterface 49 * @syscap SystemCapability.ArkUI.ArkUI.Full 50 * @crossplatform 51 * @form 52 * @atomicservice 53 * @since 11 54 */ 55interface RatingInterface { 56 /** 57 * Called when a score bar is created. 58 * 59 * @param { object } options 60 * @returns { RatingAttribute } 61 * @syscap SystemCapability.ArkUI.ArkUI.Full 62 * @since 7 63 */ 64 /** 65 * Called when a score bar is created. 66 * 67 * @param { object } options 68 * @returns { RatingAttribute } 69 * @syscap SystemCapability.ArkUI.ArkUI.Full 70 * @form 71 * @since 9 72 */ 73 /** 74 * Called when a score bar is created. 75 * 76 * @param { object } options 77 * @returns { RatingAttribute } 78 * @syscap SystemCapability.ArkUI.ArkUI.Full 79 * @crossplatform 80 * @form 81 * @since 10 82 */ 83 /** 84 * Called when a score bar is created. 85 * 86 * @param { object } options 87 * @returns { RatingAttribute } 88 * @syscap SystemCapability.ArkUI.ArkUI.Full 89 * @crossplatform 90 * @form 91 * @atomicservice 92 * @since 11 93 */ 94 (options?: { rating: number; indicator?: boolean }): RatingAttribute; 95} 96 97/** 98 * RatingConfiguration used by rating content modifier. 99 * 100 * @interface RatingConfiguration 101 * @syscap SystemCapability.ArkUI.ArkUI.Full 102 * @crossplatform 103 * @atomicservice 104 * @since 12 105 */ 106declare interface RatingConfiguration extends CommonConfiguration<RatingConfiguration> { 107 /** 108 * Current number of Rating. 109 * 110 * @type { number } 111 * @syscap SystemCapability.ArkUI.ArkUI.Full 112 * @crossplatform 113 * @atomicservice 114 * @since 12 115 */ 116 rating: number; 117 118 /** 119 * Indicates whether Rating is used as an indicator. 120 * 121 * @type { boolean } 122 * @syscap SystemCapability.ArkUI.ArkUI.Full 123 * @crossplatform 124 * @atomicservice 125 * @since 12 126 */ 127 indicator: boolean; 128 129 /** 130 * Total stars of Rating. 131 * 132 * @type { number } 133 * @syscap SystemCapability.ArkUI.ArkUI.Full 134 * @crossplatform 135 * @atomicservice 136 * @since 12 137 */ 138 stars: number; 139 140 /** 141 * The step size of the Rating. 142 * 143 * @type { number } 144 * @syscap SystemCapability.ArkUI.ArkUI.Full 145 * @crossplatform 146 * @atomicservice 147 * @since 12 148 */ 149 stepSize: number; 150 151 /** 152 * Trigger Rating select change. 153 * 154 * @type { Callback<number> } 155 * @syscap SystemCapability.ArkUI.ArkUI.Full 156 * @crossplatform 157 * @atomicservice 158 * @since 12 159 */ 160 triggerChange: Callback<number>; 161} 162 163/** 164 * Defines the rating attribute functions. 165 * 166 * @extends CommonMethod<RatingAttribute> 167 * @syscap SystemCapability.ArkUI.ArkUI.Full 168 * @since 7 169 */ 170/** 171 * Defines the rating attribute functions. 172 * 173 * @extends CommonMethod<RatingAttribute> 174 * @syscap SystemCapability.ArkUI.ArkUI.Full 175 * @form 176 * @since 9 177 */ 178/** 179 * Defines the rating attribute functions. 180 * 181 * @extends CommonMethod<RatingAttribute> 182 * @syscap SystemCapability.ArkUI.ArkUI.Full 183 * @crossplatform 184 * @form 185 * @since 10 186 */ 187/** 188 * Defines the rating attribute functions. 189 * 190 * @extends CommonMethod<RatingAttribute> 191 * @syscap SystemCapability.ArkUI.ArkUI.Full 192 * @crossplatform 193 * @form 194 * @atomicservice 195 * @since 11 196 */ 197declare class RatingAttribute extends CommonMethod<RatingAttribute> { 198 /** 199 * Called when the total number of stars is set. 200 * 201 * @param { number } value 202 * @returns { RatingAttribute } 203 * @syscap SystemCapability.ArkUI.ArkUI.Full 204 * @since 7 205 */ 206 /** 207 * Called when the total number of stars is set. 208 * 209 * @param { number } value 210 * @returns { RatingAttribute } 211 * @syscap SystemCapability.ArkUI.ArkUI.Full 212 * @form 213 * @since 9 214 */ 215 /** 216 * Called when the total number of stars is set. 217 * 218 * @param { number } value 219 * @returns { RatingAttribute } 220 * @syscap SystemCapability.ArkUI.ArkUI.Full 221 * @crossplatform 222 * @form 223 * @since 10 224 */ 225 /** 226 * Called when the total number of stars is set. 227 * 228 * @param { number } value 229 * @returns { RatingAttribute } 230 * @syscap SystemCapability.ArkUI.ArkUI.Full 231 * @crossplatform 232 * @form 233 * @atomicservice 234 * @since 11 235 */ 236 stars(value: number): RatingAttribute; 237 238 /** 239 * Called when the step size of the operation rating. 240 * 241 * @param { number } value 242 * @returns { RatingAttribute } 243 * @syscap SystemCapability.ArkUI.ArkUI.Full 244 * @since 7 245 */ 246 /** 247 * Called when the step size of the operation rating. 248 * 249 * @param { number } value 250 * @returns { RatingAttribute } 251 * @syscap SystemCapability.ArkUI.ArkUI.Full 252 * @form 253 * @since 9 254 */ 255 /** 256 * Called when the step size of the operation rating. 257 * 258 * @param { number } value 259 * @returns { RatingAttribute } 260 * @syscap SystemCapability.ArkUI.ArkUI.Full 261 * @crossplatform 262 * @form 263 * @since 10 264 */ 265 /** 266 * Called when the step size of the operation rating. 267 * 268 * @param { number } value 269 * @returns { RatingAttribute } 270 * @syscap SystemCapability.ArkUI.ArkUI.Full 271 * @crossplatform 272 * @form 273 * @atomicservice 274 * @since 11 275 */ 276 stepSize(value: number): RatingAttribute; 277 278 /** 279 * Called when a picture is set. 280 * 281 * @param { object } value 282 * @returns { RatingAttribute } 283 * @syscap SystemCapability.ArkUI.ArkUI.Full 284 * @since 7 285 */ 286 /** 287 * Called when a picture is set. 288 * 289 * @param { object } value 290 * @returns { RatingAttribute } 291 * @syscap SystemCapability.ArkUI.ArkUI.Full 292 * @form 293 * @since 9 294 */ 295 /** 296 * Called when a picture is set. 297 * 298 * @param { object } value 299 * @returns { RatingAttribute } 300 * @syscap SystemCapability.ArkUI.ArkUI.Full 301 * @crossplatform 302 * @form 303 * @since 10 304 */ 305 /** 306 * Called when a picture is set. 307 * 308 * @param { object } value 309 * @returns { RatingAttribute } 310 * @syscap SystemCapability.ArkUI.ArkUI.Full 311 * @crossplatform 312 * @form 313 * @atomicservice 314 * @since 11 315 */ 316 starStyle(value: { backgroundUri: string; foregroundUri: string; secondaryUri?: string }): RatingAttribute; 317 318 /** 319 * Called when the star rating of the operation scoring bar changes. 320 * 321 * @param { function } callback 322 * @returns { RatingAttribute } 323 * @syscap SystemCapability.ArkUI.ArkUI.Full 324 * @since 7 325 */ 326 /** 327 * Called when the star rating of the operation scoring bar changes. 328 * 329 * @param { function } callback 330 * @returns { RatingAttribute } 331 * @syscap SystemCapability.ArkUI.ArkUI.Full 332 * @form 333 * @since 9 334 */ 335 /** 336 * Called when the star rating of the operation scoring bar changes. 337 * 338 * @param { function } callback 339 * @returns { RatingAttribute } 340 * @syscap SystemCapability.ArkUI.ArkUI.Full 341 * @crossplatform 342 * @form 343 * @since 10 344 */ 345 /** 346 * Called when the star rating of the operation scoring bar changes. 347 * 348 * @param { function } callback 349 * @returns { RatingAttribute } 350 * @syscap SystemCapability.ArkUI.ArkUI.Full 351 * @crossplatform 352 * @form 353 * @atomicservice 354 * @since 11 355 */ 356 onChange(callback: (value: number) => void): RatingAttribute; 357 358 /** 359 * Set the content modifier of rating. 360 * 361 * @param { ContentModifier<RatingConfiguration> } modifier - The content modifier of rating. 362 * @returns { RatingAttribute } 363 * @syscap SystemCapability.ArkUI.ArkUI.Full 364 * @crossplatform 365 * @atomicservice 366 * @since 12 367 */ 368 contentModifier(modifier: ContentModifier<RatingConfiguration>): RatingAttribute; 369} 370 371/** 372 * Defines Rating Component. 373 * 374 * @syscap SystemCapability.ArkUI.ArkUI.Full 375 * @since 7 376 */ 377/** 378 * Defines Rating Component. 379 * 380 * @syscap SystemCapability.ArkUI.ArkUI.Full 381 * @form 382 * @since 9 383 */ 384/** 385 * Defines Rating Component. 386 * 387 * @syscap SystemCapability.ArkUI.ArkUI.Full 388 * @crossplatform 389 * @form 390 * @since 10 391 */ 392/** 393 * Defines Rating Component. 394 * 395 * @syscap SystemCapability.ArkUI.ArkUI.Full 396 * @crossplatform 397 * @form 398 * @atomicservice 399 * @since 11 400 */ 401declare const Rating: RatingInterface; 402 403/** 404 * Defines Rating Component instance. 405 * 406 * @syscap SystemCapability.ArkUI.ArkUI.Full 407 * @since 7 408 */ 409/** 410 * Defines Rating Component instance. 411 * 412 * @syscap SystemCapability.ArkUI.ArkUI.Full 413 * @form 414 * @since 9 415 */ 416/** 417 * Defines Rating Component instance. 418 * 419 * @syscap SystemCapability.ArkUI.ArkUI.Full 420 * @crossplatform 421 * @form 422 * @since 10 423 */ 424/** 425 * Defines Rating Component instance. 426 * 427 * @syscap SystemCapability.ArkUI.ArkUI.Full 428 * @crossplatform 429 * @form 430 * @atomicservice 431 * @since 11 432 */ 433declare const RatingInstance: RatingAttribute; 434