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 * indexer align property. 18 * @since 7 19 */ 20declare enum IndexerAlign { 21 /** 22 * A dialog box is displayed on the right of the index bar. 23 * @since 7 24 */ 25 Left, 26 27 /** 28 * A dialog box is displayed on the left of the index bar. 29 * @since 7 30 */ 31 Right, 32} 33 34/** 35 * Alphabet index bar. 36 * @since 7 37 */ 38interface AlphabetIndexerInterface { 39 /** 40 * ArrayValue: Alphabetical index string array. 41 * selected: ID of the selected item. 42 * @since 7 43 */ 44 (value: { arrayValue: Array<string>; selected: number }): AlphabetIndexerAttribute; 45} 46 47/** 48 * Defines the alphabet index bar attribute functions. 49 * @since 7 50 */ 51declare class AlphabetIndexerAttribute extends CommonMethod<AlphabetIndexerAttribute> { 52 /** 53 * Index bar selection callback. 54 * @since 7 55 * @deprecated since 8 56 */ 57 onSelected(callback: (index: number) => void): AlphabetIndexerAttribute; 58 59 /** 60 * Definitions color. 61 * @since 7 62 */ 63 color(value: ResourceColor): AlphabetIndexerAttribute; 64 65 /** 66 * Select the text color. 67 * @since 7 68 */ 69 selectedColor(value: ResourceColor): AlphabetIndexerAttribute; 70 71 /** 72 * Font color of the pop-up prompt text. 73 * @since 7 74 */ 75 popupColor(value: ResourceColor): AlphabetIndexerAttribute; 76 77 /** 78 * Select the text background color. 79 * @since 7 80 */ 81 selectedBackgroundColor(value: ResourceColor): AlphabetIndexerAttribute; 82 83 /** 84 * Background color of the pop-up window index. 85 * @since 7 86 */ 87 popupBackground(value: ResourceColor): AlphabetIndexerAttribute; 88 89 /** 90 * Whether to use pop-up index hints. 91 * @since 7 92 */ 93 usingPopup(value: boolean): AlphabetIndexerAttribute; 94 95 /** 96 * Select the text text style, 97 * @since 7 98 */ 99 selectedFont(value: Font): AlphabetIndexerAttribute; 100 101 /** 102 * Select the text background color. 103 * @since 7 104 */ 105 popupFont(value: Font): AlphabetIndexerAttribute; 106 107 /** 108 * Size of the letter area on the letter index bar. The letter area is a square. Set the length of the square side. 109 * @since 7 110 */ 111 itemSize(value: string | number): AlphabetIndexerAttribute; 112 113 /** 114 * Definitions fonts. 115 * @since 7 116 */ 117 font(value: Font): AlphabetIndexerAttribute; 118 119 /** 120 * Alphabet index bar alignment style. The left and right alignment styles are supported, which affects the pop-up position of the pop-up window. 121 * @since 7 122 */ 123 alignStyle(value: IndexerAlign): AlphabetIndexerAttribute; 124 125 /** 126 * Index bar selection callback. 127 * @since 8 128 */ 129 onSelect(callback: (index: number) => void): AlphabetIndexerAttribute; 130 131 /** 132 * Index bar selection callback and return the strings which display on pop-up. 133 * @since 8 134 */ 135 onRequestPopupData(callback: (index: number) => Array<string>): AlphabetIndexerAttribute; 136 137 /** 138 * Pop-up selection callback. 139 * @since 8 140 */ 141 onPopupSelect(callback: (index: number) => void): AlphabetIndexerAttribute; 142 143 /** 144 * Sets the selected index. 145 * @since 8 146 */ 147 selected(index: number): AlphabetIndexerAttribute; 148 149 /** 150 * Position of the pop-up windows, relative to the midpoint of the top border of the indexer bar. 151 * @since 8 152 */ 153 popupPosition(value: Position): AlphabetIndexerAttribute; 154} 155 156declare const AlphabetIndexer: AlphabetIndexerInterface; 157declare const AlphabetIndexerInstance: AlphabetIndexerAttribute; 158