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 * Define options used to construct a rating. 23 * 24 * @interface RatingOptions 25 * @syscap SystemCapability.ArkUI.ArkUI.Full 26 * @crossplatform 27 * @form 28 * @atomicservice 29 * @since 13 30 */ 31declare interface RatingOptions { 32 /** 33 * Rating option. 34 * 35 * @type { number } 36 * @syscap SystemCapability.ArkUI.ArkUI.Full 37 * @since 7 38 */ 39 /** 40 * Rating option. 41 * 42 * @type { number } 43 * @syscap SystemCapability.ArkUI.ArkUI.Full 44 * @form 45 * @since 9 46 */ 47 /** 48 * Rating option. 49 * 50 * @type { number } 51 * @syscap SystemCapability.ArkUI.ArkUI.Full 52 * @crossplatform 53 * @form 54 * @since 10 55 */ 56 /** 57 * Rating option. 58 * 59 * @type { number } 60 * @syscap SystemCapability.ArkUI.ArkUI.Full 61 * @crossplatform 62 * @form 63 * @atomicservice 64 * @since 11 65 */ 66 rating: number; 67 68 /** 69 * Indicator option. 70 * 71 * @type { ?boolean } 72 * @syscap SystemCapability.ArkUI.ArkUI.Full 73 * @since 7 74 */ 75 /** 76 * Indicator option. 77 * 78 * @type { ?boolean } 79 * @syscap SystemCapability.ArkUI.ArkUI.Full 80 * @form 81 * @since 9 82 */ 83 /** 84 * Indicator option. 85 * 86 * @type { ?boolean } 87 * @syscap SystemCapability.ArkUI.ArkUI.Full 88 * @crossplatform 89 * @form 90 * @since 10 91 */ 92 /** 93 * Indicator option. 94 * 95 * @type { ?boolean } 96 * @syscap SystemCapability.ArkUI.ArkUI.Full 97 * @crossplatform 98 * @form 99 * @atomicservice 100 * @since 11 101 */ 102 indicator?: boolean 103} 104 105/** 106 * Define star style options. 107 * 108 * @interface StarStyleOptions 109 * @syscap SystemCapability.ArkUI.ArkUI.Full 110 * @crossplatform 111 * @form 112 * @atomicservice 113 * @since 13 114 */ 115declare interface StarStyleOptions { 116 /** 117 * Background URI option. 118 * 119 * @type { string } 120 * @syscap SystemCapability.ArkUI.ArkUI.Full 121 * @since 7 122 */ 123 /** 124 * Background URI option. 125 * 126 * @type { string } 127 * @syscap SystemCapability.ArkUI.ArkUI.Full 128 * @form 129 * @since 9 130 */ 131 /** 132 * Background URI option. 133 * 134 * @type { string } 135 * @syscap SystemCapability.ArkUI.ArkUI.Full 136 * @crossplatform 137 * @form 138 * @since 10 139 */ 140 /** 141 * Background URI option. 142 * 143 * @type { string } 144 * @syscap SystemCapability.ArkUI.ArkUI.Full 145 * @crossplatform 146 * @form 147 * @atomicservice 148 * @since 11 149 */ 150 backgroundUri: string; 151 152 /** 153 * Foreground URI option. 154 * 155 * @type { string } 156 * @syscap SystemCapability.ArkUI.ArkUI.Full 157 * @since 7 158 */ 159 /** 160 * Foreground URI option. 161 * 162 * @type { string } 163 * @syscap SystemCapability.ArkUI.ArkUI.Full 164 * @form 165 * @since 9 166 */ 167 /** 168 * Foreground URI option. 169 * 170 * @type { string } 171 * @syscap SystemCapability.ArkUI.ArkUI.Full 172 * @crossplatform 173 * @form 174 * @since 10 175 */ 176 /** 177 * Foreground URI option. 178 * 179 * @type { string } 180 * @syscap SystemCapability.ArkUI.ArkUI.Full 181 * @crossplatform 182 * @form 183 * @atomicservice 184 * @since 11 185 */ 186 foregroundUri: string; 187 188 /** 189 * Secondary URI option. 190 * 191 * @type { ?string } 192 * @syscap SystemCapability.ArkUI.ArkUI.Full 193 * @since 7 194 */ 195 /** 196 * Secondary URI option. 197 * 198 * @type { ?string } 199 * @syscap SystemCapability.ArkUI.ArkUI.Full 200 * @form 201 * @since 9 202 */ 203 /** 204 * Secondary URI option. 205 * 206 * @type { ?string } 207 * @syscap SystemCapability.ArkUI.ArkUI.Full 208 * @crossplatform 209 * @form 210 * @since 10 211 */ 212 /** 213 * Secondary URI option. 214 * 215 * @type { ?string } 216 * @syscap SystemCapability.ArkUI.ArkUI.Full 217 * @crossplatform 218 * @form 219 * @atomicservice 220 * @since 11 221 */ 222 secondaryUri?: string 223} 224 225/** 226 * Provides the interface for scoring bars. 227 * 228 * @interface RatingInterface 229 * @syscap SystemCapability.ArkUI.ArkUI.Full 230 * @since 7 231 */ 232/** 233 * Provides the interface for scoring bars. 234 * 235 * @interface RatingInterface 236 * @syscap SystemCapability.ArkUI.ArkUI.Full 237 * @form 238 * @since 9 239 */ 240/** 241 * Provides the interface for scoring bars. 242 * 243 * @interface RatingInterface 244 * @syscap SystemCapability.ArkUI.ArkUI.Full 245 * @crossplatform 246 * @form 247 * @since 10 248 */ 249/** 250 * Provides the interface for scoring bars. 251 * 252 * @interface RatingInterface 253 * @syscap SystemCapability.ArkUI.ArkUI.Full 254 * @crossplatform 255 * @form 256 * @atomicservice 257 * @since 11 258 */ 259interface RatingInterface { 260 /** 261 * Called when a score bar is created. 262 * 263 * @param { object } options 264 * @returns { RatingAttribute } 265 * @syscap SystemCapability.ArkUI.ArkUI.Full 266 * @since 7 267 */ 268 /** 269 * Called when a score bar is created. 270 * 271 * @param { object } options 272 * @returns { RatingAttribute } 273 * @syscap SystemCapability.ArkUI.ArkUI.Full 274 * @form 275 * @since 9 276 */ 277 /** 278 * Called when a score bar is created. 279 * 280 * @param { object } options 281 * @returns { RatingAttribute } 282 * @syscap SystemCapability.ArkUI.ArkUI.Full 283 * @crossplatform 284 * @form 285 * @since 10 286 */ 287 /** 288 * Called when a score bar is created. 289 * 290 * @param { object } options 291 * @returns { RatingAttribute } 292 * @syscap SystemCapability.ArkUI.ArkUI.Full 293 * @crossplatform 294 * @form 295 * @atomicservice 296 * @since 11 297 */ 298 /** 299 * Called when a score bar is created. 300 * 301 * @param { RatingOptions } [options] - rating options 302 * @returns { RatingAttribute } 303 * @syscap SystemCapability.ArkUI.ArkUI.Full 304 * @crossplatform 305 * @form 306 * @atomicservice 307 * @since 13 308 */ 309 (options?: RatingOptions): RatingAttribute; 310} 311 312/** 313 * RatingConfiguration used by rating content modifier. 314 * 315 * @interface RatingConfiguration 316 * @syscap SystemCapability.ArkUI.ArkUI.Full 317 * @crossplatform 318 * @atomicservice 319 * @since 12 320 */ 321declare interface RatingConfiguration extends CommonConfiguration<RatingConfiguration> { 322 /** 323 * Current number of Rating. 324 * 325 * @type { number } 326 * @syscap SystemCapability.ArkUI.ArkUI.Full 327 * @crossplatform 328 * @atomicservice 329 * @since 12 330 */ 331 rating: number; 332 333 /** 334 * Indicates whether Rating is used as an indicator. 335 * 336 * @type { boolean } 337 * @syscap SystemCapability.ArkUI.ArkUI.Full 338 * @crossplatform 339 * @atomicservice 340 * @since 12 341 */ 342 indicator: boolean; 343 344 /** 345 * Total stars of Rating. 346 * 347 * @type { number } 348 * @syscap SystemCapability.ArkUI.ArkUI.Full 349 * @crossplatform 350 * @atomicservice 351 * @since 12 352 */ 353 stars: number; 354 355 /** 356 * The step size of the Rating. 357 * 358 * @type { number } 359 * @syscap SystemCapability.ArkUI.ArkUI.Full 360 * @crossplatform 361 * @atomicservice 362 * @since 12 363 */ 364 stepSize: number; 365 366 /** 367 * Trigger Rating select change. 368 * 369 * @type { Callback<number> } 370 * @syscap SystemCapability.ArkUI.ArkUI.Full 371 * @crossplatform 372 * @atomicservice 373 * @since 12 374 */ 375 triggerChange: Callback<number>; 376} 377 378/** 379 * Defines the rating attribute functions. 380 * 381 * @extends CommonMethod<RatingAttribute> 382 * @syscap SystemCapability.ArkUI.ArkUI.Full 383 * @since 7 384 */ 385/** 386 * Defines the rating attribute functions. 387 * 388 * @extends CommonMethod<RatingAttribute> 389 * @syscap SystemCapability.ArkUI.ArkUI.Full 390 * @form 391 * @since 9 392 */ 393/** 394 * Defines the rating attribute functions. 395 * 396 * @extends CommonMethod<RatingAttribute> 397 * @syscap SystemCapability.ArkUI.ArkUI.Full 398 * @crossplatform 399 * @form 400 * @since 10 401 */ 402/** 403 * Defines the rating attribute functions. 404 * 405 * @extends CommonMethod<RatingAttribute> 406 * @syscap SystemCapability.ArkUI.ArkUI.Full 407 * @crossplatform 408 * @form 409 * @atomicservice 410 * @since 11 411 */ 412declare class RatingAttribute extends CommonMethod<RatingAttribute> { 413 /** 414 * Called when the total number of stars is set. 415 * 416 * @param { number } value 417 * @returns { RatingAttribute } 418 * @syscap SystemCapability.ArkUI.ArkUI.Full 419 * @since 7 420 */ 421 /** 422 * Called when the total number of stars is set. 423 * 424 * @param { number } value 425 * @returns { RatingAttribute } 426 * @syscap SystemCapability.ArkUI.ArkUI.Full 427 * @form 428 * @since 9 429 */ 430 /** 431 * Called when the total number of stars is set. 432 * 433 * @param { number } value 434 * @returns { RatingAttribute } 435 * @syscap SystemCapability.ArkUI.ArkUI.Full 436 * @crossplatform 437 * @form 438 * @since 10 439 */ 440 /** 441 * Called when the total number of stars is set. 442 * 443 * @param { number } value 444 * @returns { RatingAttribute } 445 * @syscap SystemCapability.ArkUI.ArkUI.Full 446 * @crossplatform 447 * @form 448 * @atomicservice 449 * @since 11 450 */ 451 stars(value: number): RatingAttribute; 452 453 /** 454 * Called when the step size of the operation rating. 455 * 456 * @param { number } value 457 * @returns { RatingAttribute } 458 * @syscap SystemCapability.ArkUI.ArkUI.Full 459 * @since 7 460 */ 461 /** 462 * Called when the step size of the operation rating. 463 * 464 * @param { number } value 465 * @returns { RatingAttribute } 466 * @syscap SystemCapability.ArkUI.ArkUI.Full 467 * @form 468 * @since 9 469 */ 470 /** 471 * Called when the step size of the operation rating. 472 * 473 * @param { number } value 474 * @returns { RatingAttribute } 475 * @syscap SystemCapability.ArkUI.ArkUI.Full 476 * @crossplatform 477 * @form 478 * @since 10 479 */ 480 /** 481 * Called when the step size of the operation rating. 482 * 483 * @param { number } value 484 * @returns { RatingAttribute } 485 * @syscap SystemCapability.ArkUI.ArkUI.Full 486 * @crossplatform 487 * @form 488 * @atomicservice 489 * @since 11 490 */ 491 stepSize(value: number): RatingAttribute; 492 493 /** 494 * Called when a picture is set. 495 * 496 * @param { object } value 497 * @returns { RatingAttribute } 498 * @syscap SystemCapability.ArkUI.ArkUI.Full 499 * @since 7 500 */ 501 /** 502 * Called when a picture is set. 503 * 504 * @param { object } value 505 * @returns { RatingAttribute } 506 * @syscap SystemCapability.ArkUI.ArkUI.Full 507 * @form 508 * @since 9 509 */ 510 /** 511 * Called when a picture is set. 512 * 513 * @param { object } value 514 * @returns { RatingAttribute } 515 * @syscap SystemCapability.ArkUI.ArkUI.Full 516 * @crossplatform 517 * @form 518 * @since 10 519 */ 520 /** 521 * Called when a picture is set. 522 * 523 * @param { object } value 524 * @returns { RatingAttribute } 525 * @syscap SystemCapability.ArkUI.ArkUI.Full 526 * @crossplatform 527 * @form 528 * @atomicservice 529 * @since 11 530 */ 531 /** 532 * Called when a picture is set. 533 * 534 * @param { StarStyleOptions } options - star style options 535 * @returns { RatingAttribute } 536 * @syscap SystemCapability.ArkUI.ArkUI.Full 537 * @crossplatform 538 * @form 539 * @atomicservice 540 * @since 13 541 */ 542 starStyle(options: StarStyleOptions): RatingAttribute; 543 544 /** 545 * Called when the star rating of the operation scoring bar changes. 546 * 547 * @param { function } callback 548 * @returns { RatingAttribute } 549 * @syscap SystemCapability.ArkUI.ArkUI.Full 550 * @since 7 551 */ 552 /** 553 * Called when the star rating of the operation scoring bar changes. 554 * 555 * @param { function } callback 556 * @returns { RatingAttribute } 557 * @syscap SystemCapability.ArkUI.ArkUI.Full 558 * @form 559 * @since 9 560 */ 561 /** 562 * Called when the star rating of the operation scoring bar changes. 563 * 564 * @param { function } callback 565 * @returns { RatingAttribute } 566 * @syscap SystemCapability.ArkUI.ArkUI.Full 567 * @crossplatform 568 * @form 569 * @since 10 570 */ 571 /** 572 * Called when the star rating of the operation scoring bar changes. 573 * 574 * @param { function } callback 575 * @returns { RatingAttribute } 576 * @syscap SystemCapability.ArkUI.ArkUI.Full 577 * @crossplatform 578 * @form 579 * @atomicservice 580 * @since 11 581 */ 582 onChange(callback: (value: number) => void): RatingAttribute; 583 584 /** 585 * Set the content modifier of rating. 586 * 587 * @param { ContentModifier<RatingConfiguration> } modifier - The content modifier of rating. 588 * @returns { RatingAttribute } 589 * @syscap SystemCapability.ArkUI.ArkUI.Full 590 * @crossplatform 591 * @atomicservice 592 * @since 12 593 */ 594 contentModifier(modifier: ContentModifier<RatingConfiguration>): RatingAttribute; 595} 596 597/** 598 * Defines Rating Component. 599 * 600 * @syscap SystemCapability.ArkUI.ArkUI.Full 601 * @since 7 602 */ 603/** 604 * Defines Rating Component. 605 * 606 * @syscap SystemCapability.ArkUI.ArkUI.Full 607 * @form 608 * @since 9 609 */ 610/** 611 * Defines Rating Component. 612 * 613 * @syscap SystemCapability.ArkUI.ArkUI.Full 614 * @crossplatform 615 * @form 616 * @since 10 617 */ 618/** 619 * Defines Rating Component. 620 * 621 * @syscap SystemCapability.ArkUI.ArkUI.Full 622 * @crossplatform 623 * @form 624 * @atomicservice 625 * @since 11 626 */ 627declare const Rating: RatingInterface; 628 629/** 630 * Defines Rating Component instance. 631 * 632 * @syscap SystemCapability.ArkUI.ArkUI.Full 633 * @since 7 634 */ 635/** 636 * Defines Rating Component instance. 637 * 638 * @syscap SystemCapability.ArkUI.ArkUI.Full 639 * @form 640 * @since 9 641 */ 642/** 643 * Defines Rating Component instance. 644 * 645 * @syscap SystemCapability.ArkUI.ArkUI.Full 646 * @crossplatform 647 * @form 648 * @since 10 649 */ 650/** 651 * Defines Rating Component instance. 652 * 653 * @syscap SystemCapability.ArkUI.ArkUI.Full 654 * @crossplatform 655 * @form 656 * @atomicservice 657 * @since 11 658 */ 659declare const RatingInstance: RatingAttribute; 660