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 * CheckboxGroup SelectStatus 18 * @since 8 19 */ 20declare enum SelectStatus { 21 /** 22 * All checkboxs is selected. 23 * @since 8 24 */ 25 All, 26 /** 27 * Part of the checkbox is selected. 28 * @since 8 29 */ 30 Part, 31 /** 32 * None of the checkbox is selected. 33 * @since 8 34 */ 35 None, 36} 37 38/** 39 * Defines the options of CheckboxGroup. 40 * @since 8 41 */ 42declare interface CheckboxGroupOptions { 43 /** 44 * Setting the group of CheckboxGroup. 45 * @since 8 46 */ 47 group?: string; 48} 49 50/** 51 * Defines the options of CheckboxGroupResult. 52 * @since 8 53 */ 54declare interface CheckboxGroupResult { 55 /** 56 * Checkbox name. 57 * @since 8 58 */ 59 name: Array<string>; 60 /** 61 * Set the group of status. 62 * @since 8 63 */ 64 status: SelectStatus; 65} 66 67/** 68 * Provides an interface for the CheckboxGroup component. 69 * @since 8 70 */ 71interface CheckboxGroupInterface { 72 /** 73 * Called when the CheckboxGroup component is used. 74 * @since 8 75 */ 76 (options?: CheckboxGroupOptions): CheckboxGroupAttribute; 77} 78 79/** 80 * Defines the attribute functions of CheckboxGroup. 81 * @since 8 82 */ 83declare class CheckboxGroupAttribute extends CommonMethod<CheckboxGroupAttribute> { 84 /** 85 * setting whether all checkbox is selected. 86 * @since 8 87 */ 88 selectAll(value: boolean): CheckboxGroupAttribute; 89 90 /** 91 * setting the display color of checkbox. 92 * @since 8 93 */ 94 selectedColor(value: ResourceColor): CheckboxGroupAttribute; 95 96 /** 97 * Called when the selection status changes. 98 * @since 8 99 */ 100 onChange(callback: (event: CheckboxGroupResult) => void): CheckboxGroupAttribute; 101} 102 103declare const CheckboxGroup: CheckboxGroupInterface; 104declare const CheckboxGroupInstance: CheckboxGroupAttribute; 105