161847f8eSopenharmony_ci/*
261847f8eSopenharmony_ci* Copyright (C) 2024 Huawei Device Co., Ltd.
361847f8eSopenharmony_ci* Licensed under the Apache License, Version 2.0 (the "License");
461847f8eSopenharmony_ci* you may not use this file except in compliance with the License.
561847f8eSopenharmony_ci* You may obtain a copy of the License at
661847f8eSopenharmony_ci*
761847f8eSopenharmony_ci* http://www.apache.org/licenses/LICENSE-2.0
861847f8eSopenharmony_ci*
961847f8eSopenharmony_ci* Unless required by applicable law or agreed to in writing, software
1061847f8eSopenharmony_ci* distributed under the License is distributed on an "AS IS" BASIS,
1161847f8eSopenharmony_ci* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1261847f8eSopenharmony_ci* See the License for the specific language governing permissions and
1361847f8eSopenharmony_ci* limitations under the License.
1461847f8eSopenharmony_ci*/
1561847f8eSopenharmony_ci
1661847f8eSopenharmony_ci/**
1761847f8eSopenharmony_ci * @file Provides an advanced struct of tabs for atomic services
1861847f8eSopenharmony_ci * @kit ArkUI
1961847f8eSopenharmony_ci */
2061847f8eSopenharmony_ci
2161847f8eSopenharmony_ci/**
2261847f8eSopenharmony_ci * Defines AtomicServiceTabs.
2361847f8eSopenharmony_ci *
2461847f8eSopenharmony_ci * @struct AtomicServiceTabs
2561847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full
2661847f8eSopenharmony_ci * @atomicservice
2761847f8eSopenharmony_ci * @since 12
2861847f8eSopenharmony_ci */
2961847f8eSopenharmony_ci@Component
3061847f8eSopenharmony_ciexport declare struct AtomicServiceTabs {
3161847f8eSopenharmony_ci  /**
3261847f8eSopenharmony_ci   * The TabContent array of tabs.
3361847f8eSopenharmony_ci   *
3461847f8eSopenharmony_ci   * @type { ?[TabContentBuilder?, TabContentBuilder?, TabContentBuilder?, TabContentBuilder?, TabContentBuilder?] }.
3561847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUI.ArkUI.Full
3661847f8eSopenharmony_ci   * @atomicservice
3761847f8eSopenharmony_ci   * @since 12
3861847f8eSopenharmony_ci   */
3961847f8eSopenharmony_ci  @BuilderParam
4061847f8eSopenharmony_ci  tabContents?: [ 
4161847f8eSopenharmony_ci    TabContentBuilder?,
4261847f8eSopenharmony_ci    TabContentBuilder?,
4361847f8eSopenharmony_ci    TabContentBuilder?,
4461847f8eSopenharmony_ci    TabContentBuilder?,
4561847f8eSopenharmony_ci    TabContentBuilder?
4661847f8eSopenharmony_ci  ];
4761847f8eSopenharmony_ci  /**
4861847f8eSopenharmony_ci   * The tabBar array of tabs.
4961847f8eSopenharmony_ci   *
5061847f8eSopenharmony_ci   * @type { [TabBarOptions, TabBarOptions, TabBarOptions?, TabBarOptions?, TabBarOptions?] }.
5161847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUI.ArkUI.Full
5261847f8eSopenharmony_ci   * @atomicservice
5361847f8eSopenharmony_ci   * @since 12
5461847f8eSopenharmony_ci   */
5561847f8eSopenharmony_ci  @Prop
5661847f8eSopenharmony_ci  tabBarOptionsArray: [
5761847f8eSopenharmony_ci    TabBarOptions,
5861847f8eSopenharmony_ci    TabBarOptions,
5961847f8eSopenharmony_ci    TabBarOptions?,
6061847f8eSopenharmony_ci    TabBarOptions?,
6161847f8eSopenharmony_ci    TabBarOptions?
6261847f8eSopenharmony_ci  ];
6361847f8eSopenharmony_ci  /**
6461847f8eSopenharmony_ci   * set the positions of tabbar.
6561847f8eSopenharmony_ci   *
6661847f8eSopenharmony_ci   * @type { ?TabBarPosition }.
6761847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUI.ArkUI.Full
6861847f8eSopenharmony_ci   * @atomicservice
6961847f8eSopenharmony_ci   * @since 12
7061847f8eSopenharmony_ci   */
7161847f8eSopenharmony_ci  @Prop
7261847f8eSopenharmony_ci  tabBarPosition?: TabBarPosition;
7361847f8eSopenharmony_ci  /**
7461847f8eSopenharmony_ci   * Sets the barBackgroundColor of tabs.
7561847f8eSopenharmony_ci   *
7661847f8eSopenharmony_ci   * @type { ?ResourceColor }.
7761847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUI.ArkUI.Full
7861847f8eSopenharmony_ci   * @atomicservice
7961847f8eSopenharmony_ci   * @since 12
8061847f8eSopenharmony_ci   */
8161847f8eSopenharmony_ci  @Prop
8261847f8eSopenharmony_ci  barBackgroundColor?: ResourceColor;
8361847f8eSopenharmony_ci  /**
8461847f8eSopenharmony_ci   * Sets the index of tabs.
8561847f8eSopenharmony_ci   *
8661847f8eSopenharmony_ci   * @type { ?number }.
8761847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUI.ArkUI.Full
8861847f8eSopenharmony_ci   * @atomicservice
8961847f8eSopenharmony_ci   * @since 12
9061847f8eSopenharmony_ci   */
9161847f8eSopenharmony_ci  @Prop
9261847f8eSopenharmony_ci  index?: number;
9361847f8eSopenharmony_ci  /**
9461847f8eSopenharmony_ci   * set if need overlap, default value is true.
9561847f8eSopenharmony_ci   *
9661847f8eSopenharmony_ci   * @type { ?boolean }.
9761847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUI.ArkUI.Full
9861847f8eSopenharmony_ci   * @atomicservice
9961847f8eSopenharmony_ci   * @since 12
10061847f8eSopenharmony_ci   */
10161847f8eSopenharmony_ci  @Prop
10261847f8eSopenharmony_ci  barOverlap?: boolean;
10361847f8eSopenharmony_ci  /**
10461847f8eSopenharmony_ci   * Provide methods for switching tabs.
10561847f8eSopenharmony_ci   *
10661847f8eSopenharmony_ci   * @type { ?TabsController }.
10761847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUI.ArkUI.Full
10861847f8eSopenharmony_ci   * @atomicservice
10961847f8eSopenharmony_ci   * @since 12
11061847f8eSopenharmony_ci   */
11161847f8eSopenharmony_ci  controller?: TabsController;
11261847f8eSopenharmony_ci  /**
11361847f8eSopenharmony_ci   * onChange callback of tabs when tabs changed.
11461847f8eSopenharmony_ci   *
11561847f8eSopenharmony_ci   * @type { ?Callback<number> }.
11661847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUI.ArkUI.Full
11761847f8eSopenharmony_ci   * @atomicservice
11861847f8eSopenharmony_ci   * @since 12
11961847f8eSopenharmony_ci   */
12061847f8eSopenharmony_ci  onChange?: Callback<number>;
12161847f8eSopenharmony_ci  /**
12261847f8eSopenharmony_ci   * onTabBarClick callback of tabs when tabbar is clicked.
12361847f8eSopenharmony_ci   *
12461847f8eSopenharmony_ci   * @type { ?Callback<number> }.
12561847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUI.ArkUI.Full
12661847f8eSopenharmony_ci   * @atomicservice
12761847f8eSopenharmony_ci   * @since 12
12861847f8eSopenharmony_ci   */
12961847f8eSopenharmony_ci  onTabBarClick?: Callback<number>;
13061847f8eSopenharmony_ci  /**
13161847f8eSopenharmony_ci   * onContentWillChange callback of tabs when tabbar is clicked.
13261847f8eSopenharmony_ci   *
13361847f8eSopenharmony_ci   * @type { ?OnContentWillChangeCallback }.
13461847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUI.ArkUI.Full
13561847f8eSopenharmony_ci   * @atomicservice
13661847f8eSopenharmony_ci   * @since 12
13761847f8eSopenharmony_ci   */
13861847f8eSopenharmony_ci  onContentWillChange?: OnContentWillChangeCallback;
13961847f8eSopenharmony_ci}
14061847f8eSopenharmony_ci
14161847f8eSopenharmony_ci/**
14261847f8eSopenharmony_ci * the class for TabBarOption
14361847f8eSopenharmony_ci *
14461847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full
14561847f8eSopenharmony_ci * @atomicservice
14661847f8eSopenharmony_ci * @since 12
14761847f8eSopenharmony_ci */
14861847f8eSopenharmony_ciexport declare class TabBarOptions {
14961847f8eSopenharmony_ci  /**
15061847f8eSopenharmony_ci   * constructor to init the tabbar including icon, text, unselectedColor and selectedColor.
15161847f8eSopenharmony_ci   *
15261847f8eSopenharmony_ci   * @param { (ResourceStr | TabBarSymbol) } - icon - cannot be empty
15361847f8eSopenharmony_ci   * @param { ResourceStr } text - cannot be empty
15461847f8eSopenharmony_ci   * @param { ?ResourceColor } - unselectedColor - the color of icon and text when tabbar is unselected
15561847f8eSopenharmony_ci   * @param { ?ResourceColor } - selectedColor - the color of icon and text when tabbar is selected
15661847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUI.ArkUI.Full
15761847f8eSopenharmony_ci   * @atomicservice
15861847f8eSopenharmony_ci   * @since 12
15961847f8eSopenharmony_ci   **/
16061847f8eSopenharmony_ci  constructor(icon: ResourceStr | TabBarSymbol, text: ResourceStr,
16161847f8eSopenharmony_ci    unselectedColor?: ResourceColor, selectedColor?: ResourceColor);
16261847f8eSopenharmony_ci}
16361847f8eSopenharmony_ci
16461847f8eSopenharmony_ci/**
16561847f8eSopenharmony_ci * the enum for TabBarOption.
16661847f8eSopenharmony_ci *
16761847f8eSopenharmony_ci * @enum { number }.
16861847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full
16961847f8eSopenharmony_ci * @atomicservice
17061847f8eSopenharmony_ci * @since 12
17161847f8eSopenharmony_ci */
17261847f8eSopenharmony_ciexport declare enum TabBarPosition {
17361847f8eSopenharmony_ci
17461847f8eSopenharmony_ci  /**
17561847f8eSopenharmony_ci   * when the TabBarPosition set left,the tabs is located on the left of the tabs
17661847f8eSopenharmony_ci   *
17761847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUI.ArkUI.Full
17861847f8eSopenharmony_ci   * @atomicservice
17961847f8eSopenharmony_ci   * @since 12
18061847f8eSopenharmony_ci   */
18161847f8eSopenharmony_ci  LEFT = 0,
18261847f8eSopenharmony_ci
18361847f8eSopenharmony_ci  /**
18461847f8eSopenharmony_ci   * when the TabBarPosition set bottom,the tabs is located on the bottom of the tabs
18561847f8eSopenharmony_ci   *
18661847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUI.ArkUI.Full
18761847f8eSopenharmony_ci   * @atomicservice
18861847f8eSopenharmony_ci   * @since 12
18961847f8eSopenharmony_ci   */
19061847f8eSopenharmony_ci  BOTTOM = 1,
19161847f8eSopenharmony_ci}
19261847f8eSopenharmony_ci
19361847f8eSopenharmony_ci/**
19461847f8eSopenharmony_ci * CustomBuilder for tabContent
19561847f8eSopenharmony_ci *
19661847f8eSopenharmony_ci * @typedef { function } TabContentBuilder
19761847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full
19861847f8eSopenharmony_ci * @atomicservice
19961847f8eSopenharmony_ci * @since 12
20061847f8eSopenharmony_ci */
20161847f8eSopenharmony_ciexport type TabContentBuilder = () => void;
20261847f8eSopenharmony_ci
20361847f8eSopenharmony_ci/**
20461847f8eSopenharmony_ci * Callback for OnContentWillChange
20561847f8eSopenharmony_ci *
20661847f8eSopenharmony_ci * @typedef { function } OnContentWillChange
20761847f8eSopenharmony_ci * @param { number } currentIndex - the index value of the current tab.
20861847f8eSopenharmony_ci * @param { number } comingIndex - the index value of the tab that will change.
20961847f8eSopenharmony_ci * @returns { boolean }
21061847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full
21161847f8eSopenharmony_ci * @atomicservice
21261847f8eSopenharmony_ci * @since 12
21361847f8eSopenharmony_ci */
21461847f8eSopenharmony_ciexport type OnContentWillChangeCallback = (currentIndex: number, comingIndex: number) => boolean;