1/* 2 * Copyright (c) 2022-2023 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 * Defines the option of MenuItem. 18 * @since 9 19 */ 20 declare interface MenuItemOptions { 21 /** 22 * Defines the start display image info. 23 * @since 9 24 */ 25 startIcon?: ResourceStr; 26 27 /** 28 * Defines the content string display info. 29 * @since 9 30 */ 31 content?: ResourceStr; 32 33 /** 34 * Defines the end display image info. 35 * @since 9 36 */ 37 endIcon?: ResourceStr; 38 39 /** 40 * Defines the end label info like shortcut. 41 * @since 9 42 */ 43 labelInfo?: ResourceStr; 44 45 /** 46 * Create the submenu. 47 * @since 9 48 */ 49 builder?: CustomBuilder; 50 } 51 52 /** 53 * Defines the MenuItem Component. 54 * @since 9 55 */ 56 interface MenuItemInterface { 57 /** 58 * Creates the MenuItem component. 59 * @since 9 60 */ 61 (value?: MenuItemOptions | CustomBuilder): MenuItemAttribute; 62 } 63 64 /** 65 * Defines the MenuItem component attribute functions. 66 * @since 9 67 */ 68 declare class MenuItemAttribute extends CommonMethod<MenuItemAttribute> { 69 /** 70 * Setting whether menuItem is selected. 71 * @since 9 72 */ 73 selected(value: boolean): MenuItemAttribute; 74 /** 75 * Whether the relevant check icon is displayed when a menu item is selected. 76 * @since 9 77 */ 78 selectIcon(value: boolean): MenuItemAttribute; 79 80 /** 81 * Triggers a callback when a menu item is selected or unchecked. 82 * @param callback 83 * @since 9 84 */ 85 onChange(callback: (selected: boolean) => void): MenuItemAttribute; 86 } 87 88 /** 89 * Defines MenuItem Component. 90 * @since 9 91 */ 92 declare const MenuItem: MenuItemInterface; 93 94 /** 95 * Defines MenuItem Component instance. 96 * @since 9 97 */ 98 declare const MenuItemInstance: MenuItemAttribute; 99