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 * The declare of selectOption. 18 * @since 8 19 */ 20declare interface SelectOption { 21 /** 22 * option string. 23 * @since 8 24 */ 25 value: ResourceStr; 26 27 /** 28 * option icon. 29 * @since 8 30 */ 31 icon?: ResourceStr; 32} 33 34/** 35 * Provides the select interface. 36 * @since 8 37 */ 38interface SelectInterface { 39 /** 40 * Called when the select is set. 41 * @since 8 42 */ 43 (options: Array<SelectOption>): SelectAttribute; 44} 45 46/** 47 * The commonMethod of select. 48 * @since 8 49 */ 50declare class SelectAttribute extends CommonMethod<SelectAttribute> { 51 /** 52 * Sets the serial number of the select item, starting from 0. 53 * @since 8 54 */ 55 selected(value: number): SelectAttribute; 56 57 /** 58 * Sets the text display of the select button itself. 59 * @since 8 60 */ 61 value(value: string): SelectAttribute; 62 63 /** 64 * Sets the text properties of the select button itself. 65 * @since 8 66 */ 67 font(value: Font): SelectAttribute; 68 69 /** 70 * Sets the text color of the select button itself. 71 * @since 8 72 */ 73 fontColor(value: ResourceColor): SelectAttribute; 74 75 /** 76 * Sets the background color of the selected items in the select. 77 * @since 8 78 */ 79 selectedOptionBgColor(value: ResourceColor): SelectAttribute; 80 81 /** 82 * Sets the text style of the selected items in the select. 83 * @since 8 84 */ 85 selectedOptionFont(value: Font): SelectAttribute; 86 87 /** 88 * Sets the text color of the selected item in the select. 89 * @since 8 90 */ 91 selectedOptionFontColor(value: ResourceColor): SelectAttribute; 92 93 /** 94 * Sets the background color of the select item. 95 * @since 8 96 */ 97 optionBgColor(value: ResourceColor): SelectAttribute; 98 99 /** 100 * Sets the text style for select items. 101 * @since 8 102 */ 103 optionFont(value: Font): SelectAttribute; 104 105 /** 106 * Sets the text color for select items. 107 * @since 8 108 */ 109 optionFontColor(value: ResourceColor): SelectAttribute; 110 111 /** 112 * Callback for selecting an item from the select. 113 * @since 8 114 */ 115 onSelect(callback: (index: number, value?: string) => void): SelectAttribute; 116} 117 118/** 119 * Defines Select Component. 120 * @since 8 121 */ 122declare const Select: SelectInterface; 123 124/** 125 * Defines Select Component instance. 126 * @since 8 127 */ 128declare const SelectInstance: SelectAttribute; 129