1/* 2 * Copyright (c) 2021 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 * Provides the interface for scoring bars. 18 * @since 7 19 */ 20interface RatingInterface { 21 /** 22 * Called when a score bar is created. 23 * @since 7 24 */ 25 (options?: { rating: number; indicator?: boolean }): RatingAttribute; 26} 27 28/** 29 * Defines the rating attibute functions. 30 * @since 7 31 */ 32declare class RatingAttribute extends CommonMethod<RatingAttribute> { 33 /** 34 * Called when the total number of stars is set. 35 * @since 7 36 */ 37 stars(value: number): RatingAttribute; 38 39 /** 40 * Called when the step size of the operation rating. 41 * @since 7 42 */ 43 stepSize(value: number): RatingAttribute; 44 45 /** 46 * Called when a picture is set. 47 * @since 7 48 */ 49 starStyle(value: { backgroundUri: string; foregroundUri: string; secondaryUri?: string }): RatingAttribute; 50 51 /** 52 * Called when the star rating of the operation scoring bar changes. 53 * @since 7 54 */ 55 onChange(callback: (value: number) => void): RatingAttribute; 56} 57 58declare const Rating: RatingInterface; 59declare const RatingInstance: RatingAttribute; 60