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 * Declare the graphic format of the bar chart. 18 * @since 7 19 */ 20declare enum BarMode { 21 /** 22 * The actual layout width of the TabBar is used. If the width exceeds the total width, you can slide the tabbar. 23 * @since 7 24 */ 25 Scrollable, 26 27 /** 28 * The width of all TabBars is evenly allocated. 29 * @since 7 30 */ 31 Fixed, 32} 33 34/** 35 * Declare the location of the bar chart. 36 * @since 7 37 */ 38declare enum BarPosition { 39 /** 40 * When the vertical attribute method is set to true, the tab is on the left of the container. When the vertical property method is set to false, the tab is at the top of the container. 41 * @since 7 42 */ 43 Start, 44 45 /** 46 * When the vertical attribute method is set to true, the tab is located on the right of the container. When the vertical property method is set to false, the tab is at the bottom of the container. 47 * @since 7 48 */ 49 End, 50} 51 52/** 53 * @since 7 54 */ 55declare class TabsController { 56 /** 57 * constructor. 58 * @since 7 59 */ 60 constructor(); 61 62 /** 63 * Called when the tab is switched. 64 * @since 7 65 */ 66 changeIndex(value: number): void; 67} 68 69/** 70 * Provides an interface for switching views. 71 * @since 7 72 */ 73interface TabsInterface { 74 /** 75 * Called when the view is switched. 76 * @since 7 77 */ 78 (value?: { barPosition?: BarPosition; index?: number; controller?: TabsController }): TabsAttribute; 79} 80 81/** 82 * Defines the tabs attribute functions. 83 * @since 7 84 */ 85declare class TabsAttribute extends CommonMethod<TabsAttribute> { 86 /** 87 * Called when determining whether the tab is vertical. 88 * @since 7 89 */ 90 vertical(value: boolean): TabsAttribute; 91 92 /** 93 * Called when determining the location of the bar chart. 94 * @since 9 95 */ 96 barPosition(value: BarPosition): TabsAttribute; 97 98 /** 99 * Called when judging whether page switching can be performed by sliding left and right. 100 * @since 7 101 */ 102 scrollable(value: boolean): TabsAttribute; 103 104 /** 105 * Called when the graphic format of the bar chart is selected. 106 * @since 7 107 */ 108 barMode(value: BarMode): TabsAttribute; 109 110 /** 111 * Called when the width of the bar graph is set. 112 * Notice: barWidth only supports Number type on 7, supports Length type since 8. 113 * @since 8 114 */ 115 barWidth(value: Length): TabsAttribute; 116 117 /** 118 * Called when the height of the bar graph is set. 119 * Notice: barHeight only supports Number type on 7, supports Length type since 8. 120 * @since 8 121 */ 122 barHeight(value: Length): TabsAttribute; 123 124 /** 125 * Called when the animation duration of the bar graph is set. 126 * @since 7 127 */ 128 animationDuration(value: number): TabsAttribute; 129 130 /** 131 * Called when the tab is switched. 132 * @since 7 133 */ 134 onChange(event: (index: number) => void): TabsAttribute; 135} 136 137/** 138 * Defines Tabs Component. 139 * @since 7 140 */ 141declare const Tabs: TabsInterface; 142 143/** 144 * Defines Tabs Component instance. 145 * @since 7 146 */ 147declare const TabsInstance: TabsAttribute; 148