1/* 2* Copyright (C) 2024 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 * @file Provides an advanced struct of tabs for atomic services 18 * @kit ArkUI 19 */ 20 21/** 22 * Defines AtomicServiceTabs. 23 * 24 * @struct { AtomicServiceTabs } 25 * @syscap SystemCapability.ArkUI.ArkUI.Full 26 * @atomicservice 27 * @since 12 28 */ 29@Component 30export declare struct AtomicServiceTabs { 31 /** 32 * The TabContent array of tabs. 33 * 34 * @type { ?[TabContentBuilder?, TabContentBuilder?, TabContentBuilder?, TabContentBuilder?, TabContentBuilder?] }. 35 * @syscap SystemCapability.ArkUI.ArkUI.Full 36 * @atomicservice 37 * @since 12 38 */ 39 @BuilderParam 40 tabContents?: [ 41 TabContentBuilder?, 42 TabContentBuilder?, 43 TabContentBuilder?, 44 TabContentBuilder?, 45 TabContentBuilder? 46 ]; 47 /** 48 * The tabBar array of tabs. 49 * 50 * @type { [TabBarOptions, TabBarOptions, TabBarOptions?, TabBarOptions?, TabBarOptions?] }. 51 * @syscap SystemCapability.ArkUI.ArkUI.Full 52 * @atomicservice 53 * @since 12 54 */ 55 @Prop 56 tabBarOptionsArray: [ 57 TabBarOptions, 58 TabBarOptions, 59 TabBarOptions?, 60 TabBarOptions?, 61 TabBarOptions? 62 ]; 63 /** 64 * set the positions of tabbar. 65 * 66 * @type { ?TabBarPosition }. 67 * @syscap SystemCapability.ArkUI.ArkUI.Full 68 * @atomicservice 69 * @since 12 70 */ 71 @Prop 72 tabBarPosition?: TabBarPosition; 73 /** 74 * Set the layout mode of the bottom tab bar 75 * 76 * @type { ?LayoutMode }. 77 * @syscap SystemCapability.ArkUI.ArkUI.Full 78 * @atomicservice 79 * @since 18 80 */ 81 @Prop 82 layoutMode?: LayoutMode; 83 /** 84 * Sets the barBackgroundColor of tabs. 85 * 86 * @type { ?ResourceColor }. 87 * @syscap SystemCapability.ArkUI.ArkUI.Full 88 * @atomicservice 89 * @since 12 90 */ 91 @Prop 92 barBackgroundColor?: ResourceColor; 93 /** 94 * Sets the index of tabs. 95 * 96 * @type { ?number }. 97 * @syscap SystemCapability.ArkUI.ArkUI.Full 98 * @atomicservice 99 * @since 12 100 */ 101 @Prop 102 index?: number; 103 /** 104 * set if need overlap, default value is true. 105 * 106 * @type { ?boolean }. 107 * @syscap SystemCapability.ArkUI.ArkUI.Full 108 * @atomicservice 109 * @since 12 110 */ 111 @Prop 112 barOverlap?: boolean; 113 /** 114 * Provide methods for switching tabs. 115 * 116 * @type { ?TabsController }. 117 * @syscap SystemCapability.ArkUI.ArkUI.Full 118 * @atomicservice 119 * @since 12 120 */ 121 controller?: TabsController; 122 /** 123 * onChange callback of tabs when tabs changed. 124 * 125 * @type { ?Callback<number> }. 126 * @syscap SystemCapability.ArkUI.ArkUI.Full 127 * @atomicservice 128 * @since 12 129 */ 130 onChange?: Callback<number>; 131 /** 132 * onTabBarClick callback of tabs when tabbar is clicked. 133 * 134 * @type { ?Callback<number> }. 135 * @syscap SystemCapability.ArkUI.ArkUI.Full 136 * @atomicservice 137 * @since 12 138 */ 139 onTabBarClick?: Callback<number>; 140 /** 141 * onContentWillChange callback of tabs when tabbar is clicked. 142 * 143 * @type { ?OnContentWillChangeCallback }. 144 * @syscap SystemCapability.ArkUI.ArkUI.Full 145 * @atomicservice 146 * @since 12 147 */ 148 onContentWillChange?: OnContentWillChangeCallback; 149} 150 151/** 152 * the class for TabBarOption 153 * 154 * @syscap SystemCapability.ArkUI.ArkUI.Full 155 * @atomicservice 156 * @since 12 157 */ 158export declare class TabBarOptions { 159 /** 160 * constructor to init the tabbar including icon, text, unselectedColor and selectedColor. 161 * 162 * @param { (ResourceStr | TabBarSymbol) } - icon - cannot be empty 163 * @param { ResourceStr } text - cannot be empty 164 * @param { ?ResourceColor } - unselectedColor - the color of icon and text when tabbar is unselected 165 * @param { ?ResourceColor } - selectedColor - the color of icon and text when tabbar is selected 166 * @syscap SystemCapability.ArkUI.ArkUI.Full 167 * @atomicservice 168 * @since 12 169 **/ 170 constructor(icon: ResourceStr | TabBarSymbol, text: ResourceStr, 171 unselectedColor?: ResourceColor, selectedColor?: ResourceColor); 172} 173 174/** 175 * the enum for TabBarOption. 176 * 177 * @enum { number }. 178 * @syscap SystemCapability.ArkUI.ArkUI.Full 179 * @atomicservice 180 * @since 12 181 */ 182export declare enum TabBarPosition { 183 184 /** 185 * when the TabBarPosition set left,the tabs is located on the left of the tabs 186 * 187 * @syscap SystemCapability.ArkUI.ArkUI.Full 188 * @atomicservice 189 * @since 12 190 */ 191 LEFT = 0, 192 193 /** 194 * when the TabBarPosition set bottom,the tabs is located on the bottom of the tabs 195 * 196 * @syscap SystemCapability.ArkUI.ArkUI.Full 197 * @atomicservice 198 * @since 12 199 */ 200 BOTTOM = 1, 201} 202 203/** 204 * CustomBuilder for tabContent 205 * 206 * @typedef { function } TabContentBuilder 207 * @syscap SystemCapability.ArkUI.ArkUI.Full 208 * @atomicservice 209 * @since 12 210 */ 211export type TabContentBuilder = () => void; 212 213/** 214 * Callback for OnContentWillChange 215 * 216 * @typedef { function } OnContentWillChange 217 * @param { number } currentIndex - the index value of the current tab. 218 * @param { number } comingIndex - the index value of the tab that will change. 219 * @returns { boolean } 220 * @syscap SystemCapability.ArkUI.ArkUI.Full 221 * @atomicservice 222 * @since 12 223 */ 224export type OnContentWillChangeCallback = (currentIndex: number, comingIndex: number) => boolean;