1/* 2 * Copyright (c) 2021-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 * Enum for the mode of the tab bar when selected. 18 * 19 * @enum { number } 20 * @syscap SystemCapability.ArkUI.ArkUI.Full 21 * @crossplatform 22 * @since 10 23 */ 24declare enum SelectedMode { 25 /** 26 * The value of indicator 27 * 28 * @syscap SystemCapability.ArkUI.ArkUI.Full 29 * @crossplatform 30 * @since 10 31 */ 32 INDICATOR, 33 34 /** 35 * The value of board 36 * 37 * @syscap SystemCapability.ArkUI.ArkUI.Full 38 * @crossplatform 39 * @since 10 40 */ 41 BOARD 42} 43 44/** 45 * Enum for the layout mode of the content in the tab bar. 46 * 47 * @enum { number } 48 * @syscap SystemCapability.ArkUI.ArkUI.Full 49 * @crossplatform 50 * @since 10 51 */ 52declare enum LayoutMode { 53 54 /** 55 * The the content is laid vertically or horizontally, according to its width. 56 * 57 * @syscap SystemCapability.ArkUI.ArkUI.Full 58 * @crossplatform 59 * @since 10 60 */ 61 AUTO = 0, 62 /** 63 * The the content is laid vertically 64 * 65 * @syscap SystemCapability.ArkUI.ArkUI.Full 66 * @crossplatform 67 * @since 10 68 */ 69 VERTICAL = 1, 70 71 /** 72 * The the content is laid horizontally 73 * 74 * @syscap SystemCapability.ArkUI.ArkUI.Full 75 * @crossplatform 76 * @since 10 77 */ 78 HORIZONTAL = 2 79} 80 81 82/** 83 * Provide an interface for the style of an indicator including color, height, width, border radius 84 * and margin top 85 * 86 * @interface IndicatorStyle 87 * @syscap SystemCapability.ArkUI.ArkUI.Full 88 * @crossplatform 89 * @since 10 90 */ 91interface IndicatorStyle { 92 /** 93 * Define the color of the indicator 94 * 95 * @type { ?ResourceColor } 96 * @syscap SystemCapability.ArkUI.ArkUI.Full 97 * @crossplatform 98 * @since 10 99 */ 100 color?: ResourceColor; 101 102 /** 103 * Define the height of the indicator 104 * 105 * @type { ?Length } 106 * @syscap SystemCapability.ArkUI.ArkUI.Full 107 * @crossplatform 108 * @since 10 109 */ 110 height?: Length; 111 112 /** 113 * Define the width of the indicator. 114 * If it is 0, the width will be equal to the width of the content 115 * 116 * @type { ?Length } 117 * @default 0 118 * @syscap SystemCapability.ArkUI.ArkUI.Full 119 * @crossplatform 120 * @since 10 121 */ 122 width?: Length; 123 124 /** 125 * Define the border radius of the indicator 126 * 127 * @type { ?Length } 128 * @default 0 129 * @syscap SystemCapability.ArkUI.ArkUI.Full 130 * @crossplatform 131 * @since 10 132 */ 133 borderRadius?: Length; 134 135 /** 136 * Define the margin top of the indicator 137 * 138 * @type { ?Length } 139 * @default 8 140 * @syscap SystemCapability.ArkUI.ArkUI.Full 141 * @crossplatform 142 * @since 10 143 */ 144 marginTop?: Length; 145} 146 147/** 148 * Provide an interface for the style of an indicator including border radius 149 * 150 * @interface BoardStyle 151 * @syscap SystemCapability.ArkUI.ArkUI.Full 152 * @crossplatform 153 * @since 10 154 */ 155interface BoardStyle { 156 /** 157 * Define the border radius of the board 158 * 159 * @type { ?Length } 160 * @syscap SystemCapability.ArkUI.ArkUI.Full 161 * @crossplatform 162 * @since 10 163 */ 164 borderRadius?: Length; 165} 166 167/** 168 * LabelStyle object. 169 * 170 * @interface LabelStyle 171 * @syscap SystemCapability.ArkUI.ArkUI.Full 172 * @crossplatform 173 * @since 10 174 */ 175declare interface LabelStyle { 176 /** 177 * overflow mode. 178 * 179 * @type { ?TextOverflow } 180 * @syscap SystemCapability.ArkUI.ArkUI.Full 181 * @crossplatform 182 * @since 10 183 */ 184 overflow?: TextOverflow; 185 186 /** 187 * Label max lines. 188 * 189 * @type { ?number } 190 * @syscap SystemCapability.ArkUI.ArkUI.Full 191 * @crossplatform 192 * @since 10 193 */ 194 maxLines?: number; 195 196 /** 197 * Min font size for adapted height. 198 * 199 * @type { ?number | ResourceStr } 200 * @syscap SystemCapability.ArkUI.ArkUI.Full 201 * @crossplatform 202 * @since 10 203 */ 204 minFontSize?: number | ResourceStr; 205 206 /** 207 * Max font size for adapted height. 208 * 209 * @type { ?number | ResourceStr } 210 * @syscap SystemCapability.ArkUI.ArkUI.Full 211 * @crossplatform 212 * @since 10 213 */ 214 maxFontSize?: number | ResourceStr; 215 216 /** 217 * Adapt text height option. 218 * 219 * @type { ?TextHeightAdaptivePolicy } 220 * @syscap SystemCapability.ArkUI.ArkUI.Full 221 * @crossplatform 222 * @since 10 223 */ 224 heightAdaptivePolicy?: TextHeightAdaptivePolicy; 225 226 /** 227 * Font style. 228 * 229 * @type { ?Font } 230 * @syscap SystemCapability.ArkUI.ArkUI.Full 231 * @crossplatform 232 * @since 10 233 */ 234 font?: Font; 235} 236 237/** 238 * Define SubTabBarStyle, the style is text and underline. 239 * 240 * @syscap SystemCapability.ArkUI.ArkUI.Full 241 * @since 9 242 */ 243/** 244 * Define SubTabBarStyle, the style is text and underline. 245 * 246 * @syscap SystemCapability.ArkUI.ArkUI.Full 247 * @crossplatform 248 * @since 10 249 */ 250declare class SubTabBarStyle { 251 /** 252 * constructor. 253 * 254 * @param { ResourceStr } content - indicates the content of the sub tab bar 255 * @syscap SystemCapability.ArkUI.ArkUI.Full 256 * @since 9 257 */ 258 /** 259 * constructor. 260 * 261 * @param { ResourceStr } content - indicates the content of the sub tab bar 262 * @syscap SystemCapability.ArkUI.ArkUI.Full 263 * @crossplatform 264 * @since 10 265 */ 266 constructor(content: ResourceStr); 267 268 /** 269 * constructor 270 * 271 * @param { ResourceStr } content - indicates the content of the sub tab bar 272 * @returns { SubTabBarStyle } the style of the sub tab bar 273 * @static 274 * @syscap SystemCapability.ArkUI.ArkUI.Full 275 * @crossplatform 276 * @since 10 277 */ 278 static of(content: ResourceStr): SubTabBarStyle; 279 280 /** 281 * Set the style of the indicator when selected 282 * 283 * @param { IndicatorStyle } value - indicates the indicator style of the sub tab bar 284 * @returns { SubTabBarStyle } the style of the sub tab bar 285 * @syscap SystemCapability.ArkUI.ArkUI.Full 286 * @crossplatform 287 * @since 10 288 */ 289 indicator(value: IndicatorStyle): SubTabBarStyle; 290 291 /** 292 * Set the mode of the indicator when selected 293 * 294 * @param { SelectedMode } value - indicates the selected mode of the sub tab bar 295 * @returns { SubTabBarStyle } the style of the sub tab bar 296 * @syscap SystemCapability.ArkUI.ArkUI.Full 297 * @crossplatform 298 * @since 10 299 */ 300 selectedMode(value: SelectedMode): SubTabBarStyle; 301 302 /** 303 * Set the style of the board when selected 304 * 305 * @param { BoardStyle } value - indicates the board style of the sub tab bar 306 * @returns { SubTabBarStyle } the style of the sub tab bar 307 * @syscap SystemCapability.ArkUI.ArkUI.Full 308 * @crossplatform 309 * @since 10 310 */ 311 board(value: BoardStyle): SubTabBarStyle; 312 313 /** 314 * Set the label style of the indicator 315 * 316 * @param { LabelStyle } value - indicates the label style of the sub tab bar 317 * @returns { SubTabBarStyle } the style of the sub tab bar 318 * @syscap SystemCapability.ArkUI.ArkUI.Full 319 * @crossplatform 320 * @since 10 321 */ 322 labelStyle(value: LabelStyle): SubTabBarStyle; 323 324 /** 325 * Set the padding of the sub tab bar 326 * 327 * @param { Padding | Dimension } value - indicates the padding of the sub tab bar 328 * @returns { SubTabBarStyle } the style of the sub tab bar 329 * @syscap SystemCapability.ArkUI.ArkUI.Full 330 * @crossplatform 331 * @since 10 332 */ 333 padding(value: Padding | Dimension): SubTabBarStyle; 334} 335 336/** 337 * Define BottomTabBarStyle, the style is icon and text. 338 * 339 * @syscap SystemCapability.ArkUI.ArkUI.Full 340 * @since 9 341 */ 342/** 343 * Define BottomTabBarStyle, the style is icon and text. 344 * 345 * @syscap SystemCapability.ArkUI.ArkUI.Full 346 * @crossplatform 347 * @since 10 348 */ 349declare class BottomTabBarStyle { 350 /** 351 * constructor. 352 * 353 * @param { ResourceStr } icon - indicates the icon of the bottom tab bar 354 * @param { ResourceStr } text - indicates the text of the bottom tab bar 355 * @syscap SystemCapability.ArkUI.ArkUI.Full 356 * @since 9 357 */ 358 /** 359 * constructor. 360 * 361 * @param { ResourceStr } icon - indicates the icon of the bottom tab bar 362 * @param { ResourceStr } text - indicates the text of the bottom tab bar 363 * @syscap SystemCapability.ArkUI.ArkUI.Full 364 * @crossplatform 365 * @since 10 366 */ 367 constructor(icon: ResourceStr, text: ResourceStr); 368 369 /** 370 * of. 371 * 372 * @param { ResourceStr } icon - indicates the icon of the bottom tab bar 373 * @param { ResourceStr } text - indicates the text of the bottom tab bar 374 * @returns { BottomTabBarStyle } the style of the bottom tab bar 375 * @static 376 * @syscap SystemCapability.ArkUI.ArkUI.Full 377 * @crossplatform 378 * @since 10 379 */ 380 static of(icon: ResourceStr, text: ResourceStr): BottomTabBarStyle; 381 382 /** 383 * Set the label style of the indicator 384 * 385 * @param { LabelStyle } value - indicates the label style of the bottom tab bar 386 * @returns { BottomTabBarStyle } the style of the bottom tab bar 387 * @syscap SystemCapability.ArkUI.ArkUI.Full 388 * @crossplatform 389 * @since 10 390 */ 391 labelStyle(value: LabelStyle): BottomTabBarStyle; 392 393 /** 394 * Set the padding of the bottom tab bar 395 * 396 * @param { Padding | Dimension } value - indicates the padding of the bottom tab bar 397 * @returns { BottomTabBarStyle } the style of the bottom tab bar 398 * @syscap SystemCapability.ArkUI.ArkUI.Full 399 * @crossplatform 400 * @since 10 401 */ 402 padding(value: Padding | Dimension): BottomTabBarStyle; 403 404 /** 405 * Set the layout mode of the bottom tab bar 406 * 407 * @param { LayoutMode } value - indicates the layout mode of the bottom tab bar 408 * @returns { BottomTabBarStyle } the style of the bottom tab bar 409 * @syscap SystemCapability.ArkUI.ArkUI.Full 410 * @crossplatform 411 * @since 10 412 */ 413 layoutMode(value: LayoutMode): BottomTabBarStyle; 414 415 /** 416 * Set the vertical alignment style of the bottom tab bar 417 * 418 * @param { VerticalAlign } value - indicates the vertical alignment of the bottom tab bar 419 * @returns { BottomTabBarStyle } the style of the bottom tab bar 420 * @syscap SystemCapability.ArkUI.ArkUI.Full 421 * @crossplatform 422 * @since 10 423 */ 424 verticalAlign(value: VerticalAlign): BottomTabBarStyle; 425 426 /** 427 * Set the symmetric extensible of the bottom tab bar 428 * 429 * @param { boolean } value - indicates whether the bottom tab bar is extensible 430 * @returns { BottomTabBarStyle } the style of the bottom tab bar 431 * @syscap SystemCapability.ArkUI.ArkUI.Full 432 * @crossplatform 433 * @since 10 434 */ 435 symmetricExtensible(value: boolean): BottomTabBarStyle; 436} 437 438/** 439 * Provides an interface for switching the content view on a tab page. 440 * 441 * @interface TabContentInterface 442 * @syscap SystemCapability.ArkUI.ArkUI.Full 443 * @since 7 444 */ 445/** 446 * Provides an interface for switching the content view on a tab page. 447 * 448 * @interface TabContentInterface 449 * @syscap SystemCapability.ArkUI.ArkUI.Full 450 * @crossplatform 451 * @since 10 452 */ 453interface TabContentInterface { 454 /** 455 * Called when the content view of the switch tab is set. 456 * 457 * @returns { TabContentAttribute } 458 * @syscap SystemCapability.ArkUI.ArkUI.Full 459 * @since 7 460 */ 461 /** 462 * Called when the content view of the switch tab is set. 463 * 464 * @returns { TabContentAttribute } 465 * @syscap SystemCapability.ArkUI.ArkUI.Full 466 * @crossplatform 467 * @since 10 468 */ 469 (): TabContentAttribute; 470} 471 472/** 473 * Defines the attribute functions of TabContent. 474 * 475 * @extends CommonMethod 476 * @since 7 477 */ 478/** 479 * Defines the attribute functions of TabContent. 480 * 481 * @extends CommonMethod 482 * @crossplatform 483 * @since 10 484 */ 485declare class TabContentAttribute extends CommonMethod<TabContentAttribute> { 486 /** 487 * Called when tabbar is entered. 488 * 489 * @param { string | Resource | CustomBuilder | { icon?: string | Resource; text?: string | Resource } } value 490 * @returns { TabContentAttribute } 491 * @syscap SystemCapability.ArkUI.ArkUI.Full 492 * @since 7 493 */ 494 /** 495 * Called when tabbar is entered. 496 * 497 * @param { string | Resource | CustomBuilder | { icon?: string | Resource; text?: string | Resource } } value 498 * @returns { TabContentAttribute } 499 * @syscap SystemCapability.ArkUI.ArkUI.Full 500 * @crossplatform 501 * @since 10 502 */ 503 tabBar(value: string | Resource | CustomBuilder | 504 { icon?: string | Resource; text?: string | Resource }): TabContentAttribute; 505 506 /** 507 * Called when tabbar is entered. 508 * 509 * @param { SubTabBarStyle | BottomTabBarStyle } value 510 * @returns { TabContentAttribute } 511 * @syscap SystemCapability.ArkUI.ArkUI.Full 512 * @since 9 513 */ 514 /** 515 * Called when tabbar is entered. 516 * 517 * @param { SubTabBarStyle | BottomTabBarStyle } value 518 * @returns { TabContentAttribute } 519 * @syscap SystemCapability.ArkUI.ArkUI.Full 520 * @crossplatform 521 * @since 10 522 */ 523 tabBar(value: SubTabBarStyle | BottomTabBarStyle): TabContentAttribute; 524} 525 526/** 527 * Defines TabContent Component. 528 * 529 * @syscap SystemCapability.ArkUI.ArkUI.Full 530 * @since 7 531 */ 532/** 533 * Defines TabContent Component. 534 * 535 * @syscap SystemCapability.ArkUI.ArkUI.Full 536 * @crossplatform 537 * @since 10 538 */ 539declare const TabContent: TabContentInterface; 540 541/** 542 * Defines TabContent Component instance. 543 * 544 * @syscap SystemCapability.ArkUI.ArkUI.Full 545 * @since 7 546 */ 547/** 548 * Defines TabContent Component instance. 549 * 550 * @syscap SystemCapability.ArkUI.ArkUI.Full 551 * @crossplatform 552 * @since 10 553 */ 554declare const TabContentInstance: TabContentAttribute; 555