• 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 * Handler of swiper controller, used in finishAnimation.
22 *
23 * @typedef { function } FinishAnimationHandler
24 * @syscap SystemCapability.ArkUI.ArkUI.Circle
25 * @crossplatform
26 * @atomicservice
27 * @since 18
28 */
29declare type FinishAnimationHandler = () => void;
30
31/**
32 * Provide methods for controlling ArcSwiper component.
33 *
34 * @syscap SystemCapability.ArkUI.ArkUI.Circle
35 * @crossplatform
36 * @atomicservice
37 * @since 18
38 */
39export class ArcSwiperController {
40  /**
41   * A constructor used to create a ArcSwiperController object.
42   *
43   * @syscap SystemCapability.ArkUI.ArkUI.Circle
44   * @crossplatform
45   * @atomicservice
46   * @since 18
47   */
48  constructor();
49
50  /**
51   * Show next subcomponent.
52   *
53   * @syscap SystemCapability.ArkUI.ArkUI.Circle
54   * @crossplatform
55   * @atomicservice
56   * @since 18
57   */
58  showNext();
59
60  /**
61   * Show previous subcomponent.
62   *
63   * @syscap SystemCapability.ArkUI.ArkUI.Circle
64   * @crossplatform
65   * @atomicservice
66   * @since 18
67   */
68  showPrevious();
69
70  /**
71   * Finish the swiper animation.
72   *
73   * @param { FinishAnimationHandler } [handler] - The handler is used to listen for the end of the animation.
74   * @syscap SystemCapability.ArkUI.ArkUI.Circle
75   * @crossplatform
76   * @atomicservice
77   * @since 18
78   */
79  finishAnimation(handler?: FinishAnimationHandler);
80}
81
82/**
83 * Declare the direction of arc indicator.
84 *
85 * @enum { number }
86 * @syscap SystemCapability.ArkUI.ArkUI.Circle
87 * @crossplatform
88 * @atomicservice
89 * @since 18
90 */
91export enum ArcDirection {
92  /**
93   * 3 o'clock direction.
94   *
95   * @syscap SystemCapability.ArkUI.ArkUI.Circle
96   * @crossplatform
97   * @atomicservice
98   * @since 18
99   */
100  THREE_CLOCK_DIRECTION = 0,
101
102  /**
103   * 6 o'clock direction.
104   *
105   * @syscap SystemCapability.ArkUI.ArkUI.Circle
106   * @crossplatform
107   * @atomicservice
108   * @since 18
109   */
110  SIX_CLOCK_DIRECTION = 1,
111
112  /**
113   * 9 o'clock direction.
114   *
115   * @syscap SystemCapability.ArkUI.ArkUI.Circle
116   * @crossplatform
117   * @atomicservice
118   * @since 18
119   */
120  NINE_CLOCK_DIRECTION = 2,
121}
122
123/**
124 * Define ArcDotIndicator, the indicator type is arc dot.
125 *
126 * @syscap SystemCapability.ArkUI.ArkUI.Circle
127 * @crossplatform
128 * @atomicservice
129 * @since 18
130 */
131export class ArcDotIndicator {
132  /**
133   * A constructor used to create a ArcDotIndicator object.
134   *
135   * @syscap SystemCapability.ArkUI.ArkUI.Circle
136   * @crossplatform
137   * @atomicservice
138   * @since 18
139   */
140  constructor();
141
142  /**
143   * Set the direction of arc indicator.
144   *
145   * @param { Optional<ArcDirection> } direction - the direction of arc indicator, default value is { ArcDirection.SIX_CLOCK_DIRECTION }.
146   * @returns { ArcDotIndicator }
147   * @syscap SystemCapability.ArkUI.ArkUI.Circle
148   * @crossplatform
149   * @atomicservice
150   * @since 18
151   */
152  arcDirection(direction: Optional<ArcDirection>): ArcDotIndicator;
153
154  /**
155   * Set the navigation point color.
156   *
157   * @param { Optional<ResourceColor> } color - the indicator item color, default value is { #A9FFFFFF }.
158   * @returns { ArcDotIndicator }
159   * @syscap SystemCapability.ArkUI.ArkUI.Circle
160   * @crossplatform
161   * @atomicservice
162   * @since 18
163   */
164  itemColor(color: Optional<ResourceColor>): ArcDotIndicator;
165
166  /**
167   * Set the selected navigation point color.
168   *
169   * @param { Optional<ResourceColor> } color - the indicator item when selected, default value is { #FF5EA1FF }.
170   * @returns { ArcDotIndicator }
171   * @syscap SystemCapability.ArkUI.ArkUI.Circle
172   * @crossplatform
173   * @atomicservice
174   * @since 18
175   */
176  selectedItemColor(color: Optional<ResourceColor>): ArcDotIndicator;
177
178  /**
179   * Set the background color.
180   *
181   * @param { Optional<ResourceColor> } color - the background color, default value is { #FF404040 }.
182   * @returns { ArcDotIndicator }
183   * @syscap SystemCapability.ArkUI.ArkUI.Circle
184   * @crossplatform
185   * @atomicservice
186   * @since 18
187   */
188  backgroundColor(color: Optional<ResourceColor>): ArcDotIndicator;
189
190  /**
191   * Set the gradient color for the mask.
192   *
193   * @param { Optional<LinearGradient> } color - the gradient color, default start color is { #00000000 }, default end color is { #FF000000 }.
194   * @returns { ArcDotIndicator }
195   * @syscap SystemCapability.ArkUI.ArkUI.Circle
196   * @crossplatform
197   * @atomicservice
198   * @since 18
199   */
200  maskColor(color: Optional<LinearGradient>): ArcDotIndicator;
201}
202
203/**
204 * Provide an interface for ArcSwiper.
205 *
206 * @interface ArcSwiperInterface
207 * @syscap SystemCapability.ArkUI.ArkUI.Circle
208 * @crossplatform
209 * @atomicservice
210 * @since 18
211 */
212interface ArcSwiperInterface {
213  /**
214   * Create ArcSwiper component.
215   *
216   * @param { ArcSwiperController } [controller]
217   * @returns { ArcSwiperAttribute }
218   * @syscap SystemCapability.ArkUI.ArkUI.Circle
219   * @crossplatform
220   * @atomicservice
221   * @since 18
222   */
223  (controller?: ArcSwiperController): ArcSwiperAttribute;
224}
225
226/**
227 * Handler of swiper, used in OnChange.
228 *
229 * @typedef { function } IndexChangedHandler
230 * @param { number } index - The index of the current swiper.
231 * @syscap SystemCapability.ArkUI.ArkUI.Circle
232 * @crossplatform
233 * @atomicservice
234 * @since 18
235 */
236declare type IndexChangedHandler = (index: number) => void;
237
238/**
239 * Handler of swiper, used in OnAnimationStart.
240 *
241 * @typedef { function } AnimationStartHandler
242 * @param { number } index - The index of the current swiper.
243 * @param { number } targetIndex - The index of the target swiper.
244 * @param { SwiperAnimationEvent } event - The extra information of the animation.
245 * @syscap SystemCapability.ArkUI.ArkUI.Circle
246 * @crossplatform
247 * @atomicservice
248 * @since 18
249 */
250declare type AnimationStartHandler = (index: number, targetIndex: number, event: SwiperAnimationEvent) => void;
251
252/**
253 * Handler of swiper, used in OnAnimationEnd.
254 *
255 * @typedef { function } AnimationEndHandler
256 * @param { number } index - The index of the current swiper.
257 * @param { SwiperAnimationEvent } event - The extra information of the animation.
258 * @syscap SystemCapability.ArkUI.ArkUI.Circle
259 * @crossplatform
260 * @atomicservice
261 * @since 18
262 */
263declare type AnimationEndHandler = (index: number, event: SwiperAnimationEvent) => void;
264
265/**
266 * Handler of swiper, used in OnGestureSwipe.
267 *
268 * @typedef { function } GestureSwipeHandler
269 * @param { number } index - The index of the current swiper.
270 * @param { SwiperAnimationEvent } event - The extra information of the animation.
271 * @syscap SystemCapability.ArkUI.ArkUI.Circle
272 * @crossplatform
273 * @atomicservice
274 * @since 18
275 */
276declare type GestureSwipeHandler = (index: number, event: SwiperAnimationEvent) => void;
277
278
279/**
280 * Defines the swiper content animated transition options.
281 *
282 * @interface SwiperContentAnimatedTransition
283 * @syscap SystemCapability.ArkUI.ArkUI.Circle
284 * @crossplatform
285 * @atomicservice
286 * @since 18
287 */
288declare interface SwiperContentAnimatedTransition {
289  /**
290   * Defines the timeout of custom content transition animation after the page is moved out of the swiper. The unit is ms.
291   * If SwiperContentTransitionProxy.finishTransition() is not invoked, use the timeout as animation end time.
292   *
293   * @type { ?number }
294   * @default 0 ms
295   * @syscap SystemCapability.ArkUI.ArkUI.Circle
296   * @crossplatform
297   * @atomicservice
298   * @since 18
299   */
300  timeout?: number;
301
302  /**
303   * Called when custom content transition animation start.
304   *
305   * @type { Callback<SwiperContentTransitionProxy> }
306   * @syscap SystemCapability.ArkUI.ArkUI.Circle
307   * @crossplatform
308   * @atomicservice
309   * @since 18
310   */
311  transition: Callback<SwiperContentTransitionProxy>;
312}
313
314/**
315 *The proxy object returned to the developer during the execution of the Swiper custom content transition animation.
316 *
317 * @interface SwiperContentTransitionProxy
318 * @syscap SystemCapability.ArkUI.ArkUI.Circle
319 * @crossplatform
320 * @atomicservice
321 * @since 18
322 */
323declare interface SwiperContentTransitionProxy {
324  /**
325   * the index value of the swiper content selected before animation start.
326   *
327   * @type { number }
328   * @syscap SystemCapability.ArkUI.ArkUI.Circle
329   * @crossplatform
330   * @atomicservice
331   * @since 18
332   */
333  selectedIndex: number;
334
335  /**
336   * The index value of the swiper content.
337   *
338   * @type { number }
339   * @syscap SystemCapability.ArkUI.ArkUI.Circle
340   * @crossplatform
341   * @atomicservice
342   * @since 18
343   */
344  index: number;
345
346  /**
347   * the moving ratio of the swiper content from the start position of the swiper main axis.
348   *
349   * @type { number }
350   * @syscap SystemCapability.ArkUI.ArkUI.Circle
351   * @crossplatform
352   * @atomicservice
353   * @since 18
354   */
355  position: number;
356
357  /**
358   * the swiper main axis length for calculating position.
359   *
360   * @type { number }
361   * @syscap SystemCapability.ArkUI.ArkUI.Circle
362   * @crossplatform
363   * @atomicservice
364   * @since 18
365   */
366  mainAxisLength: number;
367
368  /**
369   * Notifies Swiper page the custom content transition animation is complete.
370   *
371   * @syscap SystemCapability.ArkUI.ArkUI.Circle
372   * @crossplatform
373   * @atomicservice
374   * @since 18
375   */
376  finishTransition(): void;
377}
378
379/**
380 * Defines the Arc swiper attribute functions.
381 *
382 * @extends CommonMethod<ArcSwiperAttribute>
383 * @syscap SystemCapability.ArkUI.ArkUI.Circle
384 * @crossplatform
385 * @atomicservice
386 * @since 18
387 */
388declare class ArcSwiperAttribute extends CommonMethod<ArcSwiperAttribute> {
389  /**
390   * Set the index value of the displayed subcomponent.
391   *
392   * @param { Optional<number> } index - The index value of the subcomponents to be displayed, default value is { 0 }.
393   * @returns { ArcSwiperAttribute }
394   * @syscap SystemCapability.ArkUI.ArkUI.Circle
395   * @crossplatform
396   * @atomicservice
397   * @since 18
398   */
399  index(index: Optional<number>): ArcSwiperAttribute;
400
401  /**
402   * Set whether the indicator is available or set the indicator style.
403   *
404   * @param { Optional<ArcDotIndicator | boolean> } style - The style information of the indicator or whether to
405   *                                                display the indicator, default value is { true }.
406   * @returns { ArcSwiperAttribute }
407   * @syscap SystemCapability.ArkUI.ArkUI.Circle
408   * @crossplatform
409   * @atomicservice
410   * @since 18
411   */
412  indicator(style: Optional<ArcDotIndicator | boolean>): ArcSwiperAttribute;
413
414  /**
415   * Set the animation duration of the switch in ms.
416   *
417   * @param { Optional<number> } duration - Duration of animation, default value is { 400ms }.
418   * @returns { ArcSwiperAttribute }
419   * @syscap SystemCapability.ArkUI.ArkUI.Circle
420   * @crossplatform
421   * @atomicservice
422   * @since 18
423   */
424  duration(duration: Optional<number>): ArcSwiperAttribute;
425
426  /**
427   * Set whether to slide vertically.
428   *
429   * @param { Optional<boolean> } isVertical - The value indicates whether to slide vertically, default value is { false }.
430   * @returns { ArcSwiperAttribute }
431   * @syscap SystemCapability.ArkUI.ArkUI.Circle
432   * @crossplatform
433   * @atomicservice
434   * @since 18
435   */
436  vertical(isVertical: Optional<boolean>): ArcSwiperAttribute;
437
438  /**
439   * Set whether to disable sliding function.
440   *
441   * @param { Optional<boolean> } disabled - The value indicates whether the sliding function is enabled, default value is { false }.
442   * @returns { ArcSwiperAttribute }
443   * @syscap SystemCapability.ArkUI.ArkUI.Circle
444   * @crossplatform
445   * @atomicservice
446   * @since 18
447   */
448  disableSwipe(disabled: Optional<boolean>): ArcSwiperAttribute;
449
450  /**
451   * Set the sensitivity of rotating crown.
452   *
453   * @param { Optional<CrownSensitivity> } sensitivity - The sensitivity of rotating crown, default value is { MEDIUM }.
454   * @returns { ArcSwiperAttribute }
455   * @syscap SystemCapability.ArkUI.ArkUI.Circle
456   * @crossplatform
457   * @atomicservice
458   * @since 18
459   */
460  digitalCrownSensitivity(sensitivity: Optional<CrownSensitivity>): ArcSwiperAttribute;
461
462  /**
463   * Called when the index value has changed.
464   *
465   * @param { Optional<IndexChangedHandler> } handler - The handler is used to listen for index values that have changed.
466   * @returns { ArcSwiperAttribute }
467   * @syscap SystemCapability.ArkUI.ArkUI.Circle
468   * @crossplatform
469   * @atomicservice
470   * @since 18
471   */
472  onChange(handler: Optional<IndexChangedHandler>): ArcSwiperAttribute;
473
474  /**
475   * Called when the swiper animation has started.
476   *
477   * @param { Optional<AnimationStartHandler> } handler - The handler is used to listen for the animation has started.
478   * @returns { ArcSwiperAttribute }
479   * @syscap SystemCapability.ArkUI.ArkUI.Circle
480   * @crossplatform
481   * @atomicservice
482   * @since 18
483   */
484  onAnimationStart(handler: Optional<AnimationStartHandler>): ArcSwiperAttribute;
485
486  /**
487   * Called when the swiper animation has ended.
488   *
489   * @param { Optional<AnimationEndHandler> } handler - The handler is used to listen for the animation has ended.
490   * @returns { ArcSwiperAttribute }
491   * @syscap SystemCapability.ArkUI.ArkUI.Circle
492   * @crossplatform
493   * @atomicservice
494   * @since 18
495   */
496  onAnimationEnd(handler: Optional<AnimationEndHandler>): ArcSwiperAttribute;
497
498  /**
499   * Called when swiping the switch using gestures.
500   *
501   * @param { Optional<GestureSwipeHandler> } handler - The handler is used to listen for swiping through gestures.
502   * @returns { ArcSwiperAttribute }
503   * @syscap SystemCapability.ArkUI.ArkUI.Circle
504   * @crossplatform
505   * @atomicservice
506   * @since 18
507   */
508  onGestureSwipe(handler: Optional<GestureSwipeHandler>): ArcSwiperAttribute;
509
510  /**
511   * Set effect when scrolling over edge.
512   *
513   * @param {  Optional<EdgeEffect> } edgeEffect - scrolling effect over edge, default value is { EdgeEffect.Spring }.
514   * @returns { ArcSwiperAttribute }
515   * @syscap SystemCapability.ArkUI.ArkUI.Circle
516   * @crossplatform
517   * @atomicservice
518   * @since 18
519   */
520  effectMode(edgeEffect: Optional<EdgeEffect>): ArcSwiperAttribute;
521
522  /**
523   * Custom swiper content transition animation.
524   *
525   * @param { Optional<SwiperContentAnimatedTransition> } transition - custom content transition animation.
526   * @returns { ArcSwiperAttribute }
527   * @syscap SystemCapability.ArkUI.ArkUI.Circle
528   * @crossplatform
529   * @atomicservice
530   * @since 18
531   */
532  customContentTransition(transition: Optional<SwiperContentAnimatedTransition>): ArcSwiperAttribute;
533
534  /**
535   * Custom swiper content transition animation.
536   *
537   * @param { Optional<boolean> } disabled - the value indicates whether to disable the transition animation, default value is { false }.
538   * @returns { ArcSwiperAttribute }
539   * @syscap SystemCapability.ArkUI.ArkUI.Circle
540   * @crossplatform
541   * @atomicservice
542   * @since 18
543   */
544  disableTransitionAnimation(disabled: Optional<boolean>): ArcSwiperAttribute;
545}
546
547/**
548 * Defines the ArcSwiper Component that can provide the ability for sub components to swipe and display.
549 *
550 * @syscap SystemCapability.ArkUI.ArkUI.Circle
551 * @crossplatform
552 * @atomicservice
553 * @since 18
554 */
555/**
556 * Defines the ArcSwiper Component that can provide the ability for sub components to swipe and display.
557 *
558 * @syscap SystemCapability.ArkUI.ArkUI.Circle
559 * @crossplatform
560 * @atomicservice
561 * @uicomponent
562 * @since 19
563 */
564declare let ArcSwiper: ArcSwiperInterface;
565
566/**
567 * Defines ArcSwiper Component instance.
568 *
569 * @syscap SystemCapability.ArkUI.ArkUI.Circle
570 * @crossplatform
571 * @atomicservice
572 * @since 18
573 */
574declare let ArcSwiperInstance: ArcSwiperAttribute;