• 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 * Enum for ArcSliderPosition
23 *
24 * @enum { string }
25 * @syscap SystemCapability.ArkUI.ArkUI.Circle
26 * @crossplatform
27 * @atomicservice
28 * @since 18
29 */
30
31export declare enum ArcSliderPosition {
32
33  /**
34   * The position is on the left
35   *
36   * @syscap SystemCapability.ArkUI.ArkUI.Circle
37   * @crossplatform
38   * @atomicservice
39   * @since 18
40   */
41  LEFT = 0,
42
43  /**
44   * The position is on the right.
45   *
46   * @syscap SystemCapability.ArkUI.ArkUI.Circle
47   * @crossplatform
48   * @atomicservice
49   * @since 18
50   */
51  RIGHT = 1
52}
53
54/**
55 * Construct parameter types for ArcSliderValueOptions.
56 *
57 * @typedef ArcSliderValueOptionsConstructorOptions
58 * @syscap SystemCapability.ArkUI.ArkUI.Circle
59 * @crossplatform
60 * @atomicservice
61 * @since 18
62 */
63interface ArcSliderValueOptionsConstructorOptions {
64  /**
65   * Set current progress value.
66   *
67   * @type { ?number }
68   * @syscap SystemCapability.ArkUI.ArkUI.Circle
69   * @crossplatform
70   * @atomicservice
71   * @since 18
72   */
73  progress?: number;
74
75  /**
76   * Set the minimum progress value.
77   *
78   * @type { ?number }
79   * @default 0
80   * @syscap SystemCapability.ArkUI.ArkUI.Circle
81   * @crossplatform
82   * @atomicservice
83   * @since 18
84   */
85  min?: number;
86
87  /**
88   * Set the maximum progress value.
89   *
90   * @type { ?number }
91   * @default 100
92   * @syscap SystemCapability.ArkUI.ArkUI.Circle
93   * @crossplatform
94   * @atomicservice
95   * @since 18
96   */
97  max?: number;
98}
99
100/**
101 * The options for ArcSlider progress value.
102 *
103 * @syscap SystemCapability.ArkUI.ArkUI.Circle
104 * @crossplatform
105 * @atomicservice
106 * @since 18
107 */
108@ObservedV2
109declare class ArcSliderValueOptions {
110  /**
111   * Set current progress value.
112   *
113   * @type { ?number }
114   * @syscap SystemCapability.ArkUI.ArkUI.Circle
115   * @crossplatform
116   * @atomicservice
117   * @since 18
118   */
119  @Trace
120  progress?: number;
121
122  /**
123   * Set the minimum progress value.
124   *
125   * @type { ?number }
126   * @default 0
127   * @syscap SystemCapability.ArkUI.ArkUI.Circle
128   * @crossplatform
129   * @atomicservice
130   * @since 18
131   */
132  @Trace
133  min?: number;
134
135  /**
136   * Set the maximum progress value.
137   *
138   * @type { ?number }
139   * @default 100
140   * @syscap SystemCapability.ArkUI.ArkUI.Circle
141   * @crossplatform
142   * @atomicservice
143   * @since 18
144   */
145  @Trace
146  max?: number;
147
148  /**
149   * The constructor used to create a ArcSliderValueOptions object.
150   *
151   * @param { ArcSliderValueOptionsConstructorOptions } options
152   * @syscap SystemCapability.ArkUI.ArkUI.Circle
153   * @crossplatform
154   * @atomicservice
155   * @since 18
156   */
157  constructor(options?: ArcSliderValueOptionsConstructorOptions);
158}
159
160/**
161 * Construct parameter types for ArcSliderLayoutOptions.
162 *
163 * @typedef ArcSliderLayoutOptionsConstructorOptions
164 * @syscap SystemCapability.ArkUI.ArkUI.Circle
165 * @crossplatform
166 * @atomicservice
167 * @since 18
168 */
169interface ArcSliderLayoutOptionsConstructorOptions {
170  /**
171   * Set whether the component's arc direction is counterclockwise.
172   *
173   * @type { ?boolean }
174   * @default true
175   * @syscap SystemCapability.ArkUI.ArkUI.Circle
176   * @crossplatform
177   * @atomicservice
178   * @since 18
179   */
180  reverse?: boolean;
181  /**
182   * Set the component's position on the screen.
183   *
184   * @type { ?ArcSliderPosition }
185   * @default ArcSliderPosition.RIGHT
186   * @syscap SystemCapability.ArkUI.ArkUI.Circle
187   * @crossplatform
188   * @atomicservice
189   * @since 18
190   */
191  position?: ArcSliderPosition;
192}
193
194/**
195 * The options for ArcSlider layout.
196 * @syscap SystemCapability.ArkUI.ArkUI.Circle
197 * @crossplatform
198 * @atomicservice
199 * @since 18
200 */
201@ObservedV2
202declare class ArcSliderLayoutOptions {
203  /**
204   * Set whether the component's arc direction is counterclockwise.
205   *
206   * @type { ?boolean }
207   * @default true
208   * @syscap SystemCapability.ArkUI.ArkUI.Circle
209   * @crossplatform
210   * @atomicservice
211   * @since 18
212   */
213  @Trace
214  reverse?: boolean;
215
216  /**
217   * Set the component's position on the screen.
218   *
219   * @type { ?ArcSliderPosition }
220   * @default ArcSliderPosition.RIGHT
221   * @syscap SystemCapability.ArkUI.ArkUI.Circle
222   * @crossplatform
223   * @atomicservice
224   * @since 18
225   */
226  @Trace
227  position?: ArcSliderPosition;
228
229  /**
230   * The constructor used to create a ArcSliderLayoutOptions object.
231   *
232   * @param { ArcSliderLayoutOptionsConstructorOptions } options
233   * @syscap SystemCapability.ArkUI.ArkUI.Circle
234   * @crossplatform
235   * @atomicservice
236   * @since 18
237   */
238  constructor(options?: ArcSliderLayoutOptionsConstructorOptions);
239}
240
241/**
242 * Construct parameter types for ArcSliderStyleOptions.
243 *
244 * @typedef ArcSliderStyleOptionsConstructorOptions
245 * @syscap SystemCapability.ArkUI.ArkUI.Circle
246 * @crossplatform
247 * @atomicservice
248 * @since 18
249 */
250interface ArcSliderStyleOptionsConstructorOptions {
251  /**
252   * Set the track thickness of the component under normal status, unit is vp.
253   *
254   * @type { ?number }
255   * @default 5
256   * @syscap SystemCapability.ArkUI.ArkUI.Circle
257   * @crossplatform
258   * @atomicservice
259   * @since 18
260   */
261  trackThickness?: number;
262
263  /**
264   * Set the track thickness of the component under active status, unit is vp.
265   *
266   * @type { ?number }
267   * @default 24
268   * @syscap SystemCapability.ArkUI.ArkUI.Circle
269   * @crossplatform
270   * @atomicservice
271   * @since 18
272   */
273  activeTrackThickness?: number;
274
275  /**
276   * Set the track color of the component.
277   *
278   * @type { ?string  }
279   * @default #33FFFFFF
280   * @syscap SystemCapability.ArkUI.ArkUI.Circle
281   * @crossplatform
282   * @atomicservice
283   * @since 18
284   */
285  trackColor?: string;
286
287  /**
288   * Set the selected color of the component.
289   *
290   * @type { ?string }
291   * @default #FF5EA1FF
292   * @syscap SystemCapability.ArkUI.ArkUI.Circle
293   * @crossplatform
294   * @atomicservice
295   * @since 18
296   */
297  selectedColor?: string;
298
299  /**
300   * Set the track blur of the component, unit is vp.
301   *
302   * @type { ?number }
303   * @default 20
304   * @syscap SystemCapability.ArkUI.ArkUI.Circle
305   * @crossplatform
306   * @atomicservice
307   * @since 18
308   */
309  trackBlur?: number;
310}
311
312/**
313 * The options for ArcSlider style.
314 *
315 * @syscap SystemCapability.ArkUI.ArkUI.Circle
316 * @crossplatform
317 * @atomicservice
318 * @since 18
319 */
320@ObservedV2
321declare class ArcSliderStyleOptions {
322  /**
323   * Set the track thickness of the component under normal status, unit is vp.
324   *
325   * @type { ?number }
326   * @default 5
327   * @syscap SystemCapability.ArkUI.ArkUI.Circle
328   * @crossplatform
329   * @atomicservice
330   * @since 18
331   */
332  @Trace
333  trackThickness?: number;
334
335  /**
336   * Set the track thickness of the component under active status, unit is vp.
337   *
338   * @type { ?number }
339   * @default 24
340   * @syscap SystemCapability.ArkUI.ArkUI.Circle
341   * @crossplatform
342   * @atomicservice
343   * @since 18
344   */
345  @Trace
346  activeTrackThickness?: number;
347
348  /**
349   * Set the track color of the component.
350   *
351   * @type { ?string }
352   * @default #33FFFFFF
353   * @syscap SystemCapability.ArkUI.ArkUI.Circle
354   * @crossplatform
355   * @atomicservice
356   * @since 18
357   */
358  @Trace
359  trackColor?: string;
360
361  /**
362   * Set the selected color of the component.
363   *
364   * @type { ?string }
365   * @default #FF5EA1FF
366   * @syscap SystemCapability.ArkUI.ArkUI.Circle
367   * @crossplatform
368   * @atomicservice
369   * @since 18
370   */
371  @Trace
372  selectedColor?: string;
373
374  /**
375   * Set the track blur of the component, unit is vp.
376   *
377   * @type { ?number }
378   * @default 20
379   * @syscap SystemCapability.ArkUI.ArkUI.Circle
380   * @crossplatform
381   * @atomicservice
382   * @since 18
383   */
384  @Trace
385  trackBlur?: number;
386
387  /**
388   * The constructor used to create a ArcSliderStyleOptions object.
389   *
390   * @param { ArcSliderStyleOptionsConstructorOptions } options
391   * @syscap SystemCapability.ArkUI.ArkUI.Circle
392   * @crossplatform
393   * @atomicservice
394   * @since 18
395   */
396  constructor(options?: ArcSliderStyleOptionsConstructorOptions);
397}
398
399/**
400 * Handler of ArcSlider, used in onTouch.
401 *
402 * @typedef { function } ArcSliderTouchHandler
403 * @param { TouchEvent } event - the TouchEvent when ArcSlider is touched.
404 * @syscap SystemCapability.ArkUI.ArkUI.Circle
405 * @crossplatform
406 * @atomicservice
407 * @since 18
408 */
409declare type ArcSliderTouchHandler = (event: TouchEvent) => void;
410
411/**
412 * Handler of ArcSlider, used in OnChange.
413 *
414 * @typedef { function } ArcSliderChangeHandler
415 * @param { number } progress - the progress value of the ArcSlider.
416 * @syscap SystemCapability.ArkUI.ArkUI.Circle
417 * @crossplatform
418 * @atomicservice
419 * @since 18
420 */
421declare type ArcSliderChangeHandler = (progress: number) => void;
422
423/**
424 * Handler of ArcSlider, used in OnEnlarge.
425 *
426 * @typedef { function } ArcSliderEnlargeHandler
427 * @param { boolean } isEnlarged - the enlarged type of the ArcSlider.
428 * @syscap SystemCapability.ArkUI.ArkUI.Circle
429 * @crossplatform
430 * @atomicservice
431 * @since 18
432 */
433declare type ArcSliderEnlargeHandler = (isEnlarged: boolean) => void;
434
435/**
436 * Construct parameter types for ArcSliderOptions.
437 *
438 * @typedef ArcSliderOptionsConstructorOptions
439 * @syscap SystemCapability.ArkUI.ArkUI.Circle
440 * @crossplatform
441 * @atomicservice
442 * @since 18
443 */
444interface ArcSliderOptionsConstructorOptions {
445  /**
446   * Configure parameters for component.
447   *
448   * @type { ?ArcSliderValueOptions }
449   * @syscap SystemCapability.ArkUI.ArkUI.Circle
450   * @crossplatform
451   * @atomicservice
452   * @since 18
453   */
454  valueOptions?: ArcSliderValueOptions;
455
456  /**
457   * Configure parameters for component.
458   *
459   * @type { ?ArcSliderLayoutOptions }
460   * @syscap SystemCapability.ArkUI.ArkUI.Circle
461   * @crossplatform
462   * @atomicservice
463   * @since 18
464   */
465  layoutOptions?: ArcSliderLayoutOptions;
466
467  /**
468   * Configure parameters for component.
469   *
470   * @type { ?ArcSliderStyleOptions }
471   * @syscap SystemCapability.ArkUI.ArkUI.Circle
472   * @crossplatform
473   * @atomicservice
474   * @since 18
475   */
476  styleOptions?: ArcSliderStyleOptions;
477
478  /**
479   * Set the sensitivity of rotating crown.
480   *
481   * @type { ?CrownSensitivity }
482   * @syscap SystemCapability.ArkUI.ArkUI.Circle
483   * @crossplatform
484   * @atomicservice
485   * @since 18
486   */
487  digitalCrownSensitivity?: CrownSensitivity;
488
489  /**
490   * Touching triggers the callback.
491   *
492   * @type { ?ArcSliderTouchHandler }
493   * @syscap SystemCapability.ArkUI.ArkUI.Circle
494   * @crossplatform
495   * @atomicservice
496   * @since 18
497   */
498  onTouch?: ArcSliderTouchHandler;
499
500  /**
501   * Value changing triggers the callback.
502   *
503   * @type { ?ArcSliderChangeHandler }
504   * @syscap SystemCapability.ArkUI.ArkUI.Circle
505   * @crossplatform
506   * @atomicservice
507   * @since 18
508   */
509  onChange?: ArcSliderChangeHandler;
510
511  /**
512   * Enlarged type changging triggers the callback.
513   *
514   * @type { ?ArcSliderEnlargeHandler }
515   * @syscap SystemCapability.ArkUI.ArkUI.Circle
516   * @crossplatform
517   * @atomicservice
518   * @since 18
519   */
520  onEnlarge?: ArcSliderEnlargeHandler;
521}
522
523/**
524 * The options for ArcSlider.
525 *
526 * @syscap SystemCapability.ArkUI.ArkUI.Circle
527 * @crossplatform
528 * @atomicservice
529 * @since 18
530 */
531@ObservedV2
532declare class ArcSliderOptions {
533  /**
534   * Configure parameters for component.
535   *
536   * @type { ?ArcSliderValueOptions }
537   * @syscap SystemCapability.ArkUI.ArkUI.Circle
538   * @crossplatform
539   * @atomicservice
540   * @since 18
541   */
542  @Trace
543  valueOptions?: ArcSliderValueOptions;
544
545  /**
546   * Configure parameters for component.
547   *
548   * @type { ?ArcSliderLayoutOptions }
549   * @syscap SystemCapability.ArkUI.ArkUI.Circle
550   * @crossplatform
551   * @atomicservice
552   * @since 18
553   */
554  @Trace
555  layoutOptions?: ArcSliderLayoutOptions;
556
557  /**
558   * Configure parameters for component.
559   *
560   * @type { ?ArcSliderStyleOptions }
561   * @syscap SystemCapability.ArkUI.ArkUI.Circle
562   * @crossplatform
563   * @atomicservice
564   * @since 18
565   */
566  @Trace
567  styleOptions?: ArcSliderStyleOptions;
568
569  /**
570   * Set the sensitivity of rotating crown.
571   *
572   * @type { ?CrownSensitivity }
573   * @syscap SystemCapability.ArkUI.ArkUI.Circle
574   * @crossplatform
575   * @atomicservice
576   * @since 18
577   */
578  @Trace
579  digitalCrownSensitivity?: CrownSensitivity;
580
581  /**
582   * Touching triggers the callback.
583   *
584   * @type { ?ArcSliderTouchHandler }
585   * @syscap SystemCapability.ArkUI.ArkUI.Circle
586   * @crossplatform
587   * @atomicservice
588   * @since 18
589   */
590  @Trace
591  onTouch?: ArcSliderTouchHandler;
592
593  /**
594   * Value changing triggers the callback.
595   *
596   * @type { ?ArcSliderChangeHandler }
597   * @syscap SystemCapability.ArkUI.ArkUI.Circle
598   * @crossplatform
599   * @atomicservice
600   * @since 18
601   */
602  @Trace
603  onChange?: ArcSliderChangeHandler;
604
605  /**
606   * Enlarged type changging triggers the callback.
607   *
608   * @type { ?ArcSliderEnlargeHandler }
609   * @syscap SystemCapability.ArkUI.ArkUI.Circle
610   * @crossplatform
611   * @atomicservice
612   * @since 18
613   */
614  @Trace
615  onEnlarge?: ArcSliderEnlargeHandler;
616
617  /**
618   * The constructor used to create a ArcSliderOptions object.
619   *
620   * @param { ArcSliderOptionsConstructorOptions } options
621   * @syscap SystemCapability.ArkUI.ArkUI.Circle
622   * @crossplatform
623   * @atomicservice
624   * @since 18
625   */
626  constructor(options?: ArcSliderOptionsConstructorOptions);
627}
628
629/**
630 * Defines ArcSlider Component.
631 *
632 * @syscap SystemCapability.ArkUI.ArkUI.Circle
633 * @crossplatform
634 * @atomicservice
635 * @since 18
636 */
637@Component
638declare struct ArcSlider {
639  /**
640   * The options of a ArcSlider component.
641   *
642   * @type { ArcSliderOptions }
643   * @syscap SystemCapability.ArkUI.ArkUI.Circle
644   * @crossplatform
645   * @atomicservice
646   * @since 18
647   */
648  options: ArcSliderOptions;
649}
650
651export {
652  ArcSlider,
653  ArcSliderOptions,
654  ArcSliderValueOptions,
655  ArcSliderLayoutOptions,
656  ArcSliderStyleOptions,
657  ArcSliderValueOptionsConstructorOptions,
658  ArcSliderLayoutOptionsConstructorOptions,
659  ArcSliderStyleOptionsConstructorOptions,
660  ArcSliderOptionsConstructorOptions,
661  ArcSliderTouchHandler,
662  ArcSliderChangeHandler
663};