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