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 method of switching the cursor position. 18 * @since 8 19 */ 20declare class SearchController { 21 /** 22 * constructor. 23 * @since 8 24 */ 25 constructor(); 26 /** 27 * Called when the position of the insertion cursor is set. 28 * @since 8 29 */ 30 caretPosition(value: number): void; 31} 32 33/** 34 * The construct function of search 35 * @since 8 36 */ 37interface SearchInterface { 38 (options?: { value?: string; 39 placeholder?: string; 40 icon?: string; 41 controller?: SearchController 42 }): SearchAttribute; 43} 44 45/** 46 * The attribute function of search 47 * @since 8 48 */ 49declare class SearchAttribute extends CommonMethod<SearchAttribute> { 50 /** 51 * Set the search button text 52 * @since 8 53 */ 54 searchButton(value: string): SearchAttribute; 55 56 /** 57 * Set the place hold text color 58 * @since 8 59 */ 60 placeholderColor(value: ResourceColor): SearchAttribute; 61 62 /** 63 * Set the font used for place holder text 64 * @since 8 65 */ 66 placeholderFont(value?: Font): SearchAttribute; 67 68 /** 69 * Set the font used for input text 70 * @since 8 71 */ 72 textFont(value?: Font): SearchAttribute; 73 74 /** 75 * Call the function when clicked the search button 76 * @since 8 77 */ 78 onSubmit(callback: (value: string) => void): SearchAttribute; 79 80 /** 81 * Call the function when editing the input text 82 * @since 8 83 */ 84 onChange(callback: (value: string) => void): SearchAttribute; 85 86 /** 87 * Called when using the Clipboard menu 88 * @since 8 89 */ 90 onCopy(callback: (value: string) => void): SearchAttribute; 91 92 /** 93 * Called when using the Clipboard menu 94 * @since 8 95 */ 96 onCut(callback: (value: string) => void): SearchAttribute; 97 98 /** 99 * Called when using the Clipboard menu 100 * @since 8 101 */ 102 onPaste(callback: (value: string) => void): SearchAttribute; 103 104 /** 105 * Called when the copy option is set. 106 * @since 9 107 */ 108 copyOption(value: CopyOptions): SearchAttribute; 109 110 /** 111 * Called when the text align is set. 112 * @since 9 113 */ 114 textAlign(value: TextAlign): SearchAttribute; 115} 116 117/** 118 * Defines Search Component. 119 * @since 8 120 */ 121declare const Search: SearchInterface; 122 123/** 124 * Defines Search Component instance. 125 * @since 8 126 */ 127declare const SearchInstance: SearchAttribute; 128