• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
18 * @kit ArkUI
19 */
20
21/**
22 * Provides methods for switching components.
23 *
24 * @syscap SystemCapability.ArkUI.ArkUI.Full
25 * @crossplatform
26 * @form
27 * @atomicservice
28 * @since 15
29 */
30declare class IndicatorComponentController {
31  /**
32   * constructor.
33   *
34   * @syscap SystemCapability.ArkUI.ArkUI.Full
35   * @crossplatform
36   * @form
37   * @atomicservice
38   * @since 15
39   */
40  constructor();
41
42  /**
43   * Called when the next child component is displayed.
44   *
45   * @syscap SystemCapability.ArkUI.ArkUI.Full
46   * @crossplatform
47   * @form
48   * @atomicservice
49   * @since 15
50   */
51  showNext():void;
52
53  /**
54   * Called when the previous subcomponent is displayed.
55   *
56   * @syscap SystemCapability.ArkUI.ArkUI.Full
57   * @crossplatform
58   * @form
59   * @atomicservice
60   * @since 15
61   */
62  showPrevious():void;
63
64   /**
65   * Controlling IndicatorComponent to change to the specified subcomponent.
66   *
67   * @param { number } index - The index of item to be redirected.
68   * @param { boolean } [useAnimation] - If true, swipe to index item with animation. If false, swipe to index item without animation.
69   *      The default value is false.
70   * @syscap SystemCapability.ArkUI.ArkUI.Full
71   * @crossplatform
72   * @form
73   * @atomicservice
74   * @since 15
75   */
76  changeIndex(index: number, useAnimation?: boolean):void;
77}
78
79/**
80 * Provides an interface for indicator.
81 *
82 * @interface IndicatorComponentInterface
83 * @syscap SystemCapability.ArkUI.ArkUI.Full
84 * @crossplatform
85 * @form
86 * @atomicservice
87 * @since 15
88 */
89interface IndicatorComponentInterface {
90
91  /**
92   * Called when a indicator is set.
93   *
94   * @param { IndicatorComponentController } controller - indicator component controller.
95   * @returns { IndicatorComponentAttribute }
96   * @syscap SystemCapability.ArkUI.ArkUI.Full
97   * @crossplatform
98   * @form
99   * @atomicservice
100   * @since 15
101   */
102  (controller?: IndicatorComponentController): IndicatorComponentAttribute;
103}
104
105/**
106 * Defines the IndicatorComponent attribute functions.
107 *
108 * @extends CommonMethod<IndicatorComponentAttribute>
109 * @syscap SystemCapability.ArkUI.ArkUI.Full
110 * @crossplatform
111 * @form
112 * @atomicservice
113 * @since 15
114 */
115declare class IndicatorComponentAttribute extends CommonMethod<IndicatorComponentAttribute> {
116 /**
117   * Called when the index value of the displayed subcomponent is set in the container.
118   *
119   * @param { number } index
120   * @returns { IndicatorComponentAttribute }
121   * @syscap SystemCapability.ArkUI.ArkUI.Full
122   * @crossplatform
123   * @form
124   * @atomicservice
125   * @since 15
126   */
127  initialIndex(index: number): IndicatorComponentAttribute;
128
129  /**
130   * Sets the total number of indicator.
131   *
132   * @param { number } totalCount
133   * @returns { IndicatorComponentAttribute }
134   * @syscap SystemCapability.ArkUI.ArkUI.Full
135   * @crossplatform
136   * @form
137   * @atomicservice
138   * @since 15
139   */
140  count(totalCount: number): IndicatorComponentAttribute;
141
142  /**
143   * Sets the indicator style.
144   *
145   * @param { DotIndicator | DigitIndicator } indicatorStyle - the style value
146   * @returns { IndicatorComponentAttribute }
147   * @syscap SystemCapability.ArkUI.ArkUI.Full
148   * @crossplatform
149   * @form
150   * @atomicservice
151   * @since 15
152   */
153  style(indicatorStyle: DotIndicator | DigitIndicator): IndicatorComponentAttribute;
154
155  /**
156   * Called when setting whether to turn on cyclic sliding.
157   *
158   * @param { boolean } isLoop
159   * @returns { IndicatorComponentAttribute }
160   * @syscap SystemCapability.ArkUI.ArkUI.Full
161   * @crossplatform
162   * @form
163   * @atomicservice
164   * @since 15
165   */
166  loop(isLoop: boolean): IndicatorComponentAttribute;
167
168  /**
169   * Called when setting whether to slide vertically.
170   *
171   * @param { boolean } isVertical
172   * @returns { IndicatorComponentAttribute }
173   * @syscap SystemCapability.ArkUI.ArkUI.Full
174   * @crossplatform
175   * @form
176   * @atomicservice
177   * @since 15
178   */
179  vertical(isVertical: boolean): IndicatorComponentAttribute;
180
181  /**
182   * Called when the index value changes.
183   *
184   * @param { Callback<number> } event
185   * @returns { IndicatorComponentAttribute }
186   * @syscap SystemCapability.ArkUI.ArkUI.Full
187   * @crossplatform
188   * @form
189   * @atomicservice
190   * @since 15
191   */
192  onChange(event: Callback<number>): IndicatorComponentAttribute;
193}
194
195/**
196 * Defines IndicatorComponent.
197 *
198 * @syscap SystemCapability.ArkUI.ArkUI.Full
199 * @crossplatform
200 * @form
201 * @atomicservice
202 * @since 15
203 */
204declare const IndicatorComponent: IndicatorComponentInterface;
205
206/**
207 * Defines IndicatorComponent instance.
208 *
209 * @syscap SystemCapability.ArkUI.ArkUI.Full
210 * @crossplatform
211 * @form
212 * @atomicservice
213 * @since 15
214 */
215declare const IndicatorComponentInstance: IndicatorComponentAttribute;
216