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 * Naivagtion title mode. 18 * @since 8 19 */ 20declare enum NavigationTitleMode { 21 /** 22 * The title is free mode. 23 * @since 8 24 */ 25 Free = 0, 26 27 /** 28 * The title is full mode. 29 * @since 8 30 */ 31 Full, 32 33 /** 34 * The title is mini mode. 35 * @since 8 36 */ 37 Mini, 38} 39 40declare interface NavigationMenuItem { 41 /** 42 * The value of navigation menu item. 43 * @since 8 44 */ 45 value: string; 46 /** 47 * The icon of navigation menu item. 48 * @since 8 49 */ 50 icon?: string; 51 /** 52 * Trigger by navigation menu item click. 53 * @since 8 54 */ 55 action?: () => void; 56} 57 58/** 59 * Provide navigator view interface 60 * @since 8 61 */ 62interface NavigationInterface { 63 /** 64 * Called when the navigator view interface is used. 65 * @since 8 66 */ 67 (): NavigationAttribute; 68} 69 70/** 71 * Declare Navigation view properties. 72 * @since 8 73 */ 74declare class NavigationAttribute extends CommonMethod<NavigationAttribute> { 75 /** 76 * Navigation title 77 * @since 8 78 */ 79 title(value: string | CustomBuilder): NavigationAttribute; 80 81 /** 82 * Navigation subtitle 83 * @since 8 84 */ 85 subTitle(value: string): NavigationAttribute; 86 87 /** 88 * Hide navigation bar 89 * @since 8 90 */ 91 hideTitleBar(value: boolean): NavigationAttribute; 92 93 /** 94 * Hide navigation back button 95 * @since 8 96 */ 97 hideBackButton(value: boolean): NavigationAttribute; 98 99 /** 100 * Navigation title mode 101 * @since 8 102 */ 103 titleMode(value: NavigationTitleMode): NavigationAttribute; 104 105 /** 106 * Navigation title bar's menus 107 * @since 8 108 */ 109 menus(value: Array<NavigationMenuItem> | CustomBuilder): NavigationAttribute; 110 111 /** 112 * Tool bar 113 * @since 8 114 */ 115 toolBar(value: object | CustomBuilder): NavigationAttribute; 116 117 /** 118 * Hide tool bar 119 * @since 8 120 */ 121 hideToolBar(value: boolean): NavigationAttribute; 122 123 /** 124 * Trigger callback when title mode change finished at free mode. 125 * @since 8 126 */ 127 onTitleModeChange(callback: (titleMode: NavigationTitleMode) => void): NavigationAttribute; 128} 129 130declare const Navigation: NavigationInterface; 131declare const NavigationInstance: NavigationAttribute; 132