• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2023 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 the counter type.
23 *
24 * @enum { number }
25 * @syscap SystemCapability.ArkUI.ArkUI.Full
26 * @crossplatform
27 * @since 11
28 */
29 /**
30 * Enum for the counter type.
31 *
32 * @enum { number }
33 * @syscap SystemCapability.ArkUI.ArkUI.Full
34 * @crossplatform
35 * @atomicservice
36 * @since 12
37 */
38declare enum CounterType {
39    /**
40     * List counter.
41     * @syscap SystemCapability.ArkUI.ArkUI.Full
42     * @crossplatform
43     * @since 11
44     */
45     /**
46     * List counter.
47     * @syscap SystemCapability.ArkUI.ArkUI.Full
48     * @crossplatform
49     * @atomicservice
50     * @since 12
51     */
52    LIST = 0,
53
54    /**
55     * Compact counter.
56     * @syscap SystemCapability.ArkUI.ArkUI.Full
57     * @crossplatform
58     * @since 11
59     */
60     /**
61     * Compact counter.
62     * @syscap SystemCapability.ArkUI.ArkUI.Full
63     * @crossplatform
64     * @atomicservice
65     * @since 12
66     */
67    COMPACT = 1,
68
69    /**
70     * Inline counter.
71     * @syscap SystemCapability.ArkUI.ArkUI.Full
72     * @crossplatform
73     * @since 11
74     */
75     /**
76     * Inline counter.
77     * @syscap SystemCapability.ArkUI.ArkUI.Full
78     * @crossplatform
79     * @atomicservice
80     * @since 12
81     */
82    INLINE = 2,
83
84    /**
85     * Date inline counter.
86     * @syscap SystemCapability.ArkUI.ArkUI.Full
87     * @crossplatform
88     * @since 11
89     */
90     /**
91     * Date inline counter.
92     * @syscap SystemCapability.ArkUI.ArkUI.Full
93     * @crossplatform
94     * @atomicservice
95     * @since 12
96     */
97    INLINE_DATE = 3
98}
99
100/**
101 * Defines the common options.
102 *
103 * @syscap SystemCapability.ArkUI.ArkUI.Full
104 * @crossplatform
105 * @since 11
106 */
107 /**
108 * Defines the common options.
109 *
110 * @syscap SystemCapability.ArkUI.ArkUI.Full
111 * @crossplatform
112 * @atomicservice
113 * @since 12
114 */
115declare class CommonOptions {
116    /**
117     * Set the focusable of the counter component.
118     * @type { ?boolean }
119     * @default true
120     * @syscap SystemCapability.ArkUI.ArkUI.Full
121     * @crossplatform
122     * @since 11
123     */
124     /**
125     * Set the focusable of the counter component.
126     * @type { ?boolean }
127     * @default true
128     * @syscap SystemCapability.ArkUI.ArkUI.Full
129     * @crossplatform
130     * @atomicservice
131     * @since 12
132     */
133    focusable?: boolean;
134
135    /**
136     * Set the step of the couter component, ranges greater than or equal to 1
137     *
138     * @type { ?number }
139     * @default 1
140     * @syscap SystemCapability.ArkUI.ArkUI.Full
141     * @crossplatform
142     * @since 11
143     */
144     /**
145     * Set the step of the couter component, ranges greater than or equal to 1
146     *
147     * @type { ?number }
148     * @default 1
149     * @syscap SystemCapability.ArkUI.ArkUI.Full
150     * @crossplatform
151     * @atomicservice
152     * @since 12
153     */
154    step?: number;
155
156    /**
157     * Trigger a mouse hover event at the increased button.
158     *
159     * @type { ?function }
160     * @syscap SystemCapability.ArkUI.ArkUI.Full
161     * @crossplatform
162     * @since 11
163     */
164     /**
165     * Trigger a mouse hover event at the increased button.
166     *
167     * @type { ?function }
168     * @syscap SystemCapability.ArkUI.ArkUI.Full
169     * @crossplatform
170     * @atomicservice
171     * @since 12
172     */
173    onHoverIncrease?: (isHover: boolean) => void;
174
175    /**
176     * Trigger a mouse hover event at the decreased button.
177     *
178     * @type { ?function }
179     * @syscap SystemCapability.ArkUI.ArkUI.Full
180     * @crossplatform
181     * @since 11
182     */
183     /**
184     * Trigger a mouse hover event at the decreased button.
185     *
186     * @type { ?function }
187     * @syscap SystemCapability.ArkUI.ArkUI.Full
188     * @crossplatform
189     * @atomicservice
190     * @since 12
191     */
192    onHoverDecrease?: (isHover: boolean) => void;
193}
194
195/**
196 * Defines the inline style options.
197 *
198 * @syscap SystemCapability.ArkUI.ArkUI.Full
199 * @crossplatform
200 * @since 11
201 */
202 /**
203 * Defines the inline style options.
204 *
205 * @syscap SystemCapability.ArkUI.ArkUI.Full
206 * @crossplatform
207 * @atomicservice
208 * @since 12
209 */
210declare class InlineStyleOptions extends CommonOptions {
211    /**
212     * Set initial value of the counter component, ranges from min to max.
213     *
214     * @type { ?number }
215     * @default 0
216     * @syscap SystemCapability.ArkUI.ArkUI.Full
217     * @crossplatform
218     * @since 11
219     */
220     /**
221     * Set initial value of the counter component, ranges from min to max.
222     *
223     * @type { ?number }
224     * @default 0
225     * @syscap SystemCapability.ArkUI.ArkUI.Full
226     * @crossplatform
227     * @atomicservice
228     * @since 12
229     */
230    value?: number;
231
232    /**
233     * Set minimum value of the counter component
234     *
235     * @type { ?number }
236     * @default 0
237     * @syscap SystemCapability.ArkUI.ArkUI.Full
238     * @crossplatform
239     * @since 11
240     */
241     /**
242     * Set minimum value of the counter component
243     *
244     * @type { ?number }
245     * @default 0
246     * @syscap SystemCapability.ArkUI.ArkUI.Full
247     * @crossplatform
248     * @atomicservice
249     * @since 12
250     */
251    min?: number;
252
253    /**
254     * Set maximum value of the counter component
255     *
256     * @type { ?number }
257     * @default 999
258     * @syscap SystemCapability.ArkUI.ArkUI.Full
259     * @crossplatform
260     * @since 11
261     */
262     /**
263     * Set maximum value of the counter component
264     *
265     * @type { ?number }
266     * @default 999
267     * @syscap SystemCapability.ArkUI.ArkUI.Full
268     * @crossplatform
269     * @atomicservice
270     * @since 12
271     */
272    max?: number;
273
274    /**
275     * Set text width  of the counter component,  ranges greater than or equal to 0
276     *
277     * @type { ?number }
278     * @default 0
279     * @syscap SystemCapability.ArkUI.ArkUI.Full
280     * @crossplatform
281     * @since 11
282     */
283     /**
284     * Set text width  of the counter component,  ranges greater than or equal to 0
285     *
286     * @type { ?number }
287     * @default 0
288     * @syscap SystemCapability.ArkUI.ArkUI.Full
289     * @crossplatform
290     * @atomicservice
291     * @since 12
292     */
293    textWidth?: number;
294
295    /**
296     * Trigger a event when the value of the counter has been changed.
297     *
298     * @type { ?function }
299     * @syscap SystemCapability.ArkUI.ArkUI.Full
300     * @crossplatform
301     * @since 11
302     */
303     /**
304     * Trigger a event when the value of the counter has been changed.
305     *
306     * @type { ?function }
307     * @syscap SystemCapability.ArkUI.ArkUI.Full
308     * @crossplatform
309     * @atomicservice
310     * @since 12
311     */
312    onChange?: (value: number) => void;
313}
314
315/**
316 * Defines the number style options.
317 *
318 * @syscap SystemCapability.ArkUI.ArkUI.Full
319 * @crossplatform
320 * @since 11
321 */
322 /**
323 * Defines the number style options.
324 *
325 * @syscap SystemCapability.ArkUI.ArkUI.Full
326 * @crossplatform
327 * @atomicservice
328 * @since 12
329 */
330declare class NumberStyleOptions extends InlineStyleOptions {
331    /**
332     * Set the label of the counter component.
333     *
334     * @type { ?ResourceStr }
335     * @syscap SystemCapability.ArkUI.ArkUI.Full
336     * @crossplatform
337     * @since 11
338     */
339     /**
340     * Set the label of the counter component.
341     *
342     * @type { ?ResourceStr }
343     * @syscap SystemCapability.ArkUI.ArkUI.Full
344     * @crossplatform
345     * @atomicservice
346     * @since 12
347     */
348    label?: ResourceStr;
349
350    /**
351     * Trigger a event when the increased button got focus.
352     *
353     * @type { ?function }
354     * @syscap SystemCapability.ArkUI.ArkUI.Full
355     * @crossplatform
356     * @since 11
357     */
358     /**
359     * Trigger a event when the increased button got focus.
360     *
361     * @type { ?function }
362     * @syscap SystemCapability.ArkUI.ArkUI.Full
363     * @crossplatform
364     * @atomicservice
365     * @since 12
366     */
367    onFocusIncrease?: () => void;
368
369    /**
370     * Trigger a event when the decreased button got focus.
371     *
372     * @type { ?function }
373     * @syscap SystemCapability.ArkUI.ArkUI.Full
374     * @crossplatform
375     * @since 11
376     */
377     /**
378     * Trigger a event when the decreased button got focus.
379     *
380     * @type { ?function }
381     * @syscap SystemCapability.ArkUI.ArkUI.Full
382     * @crossplatform
383     * @atomicservice
384     * @since 12
385     */
386    onFocusDecrease?: () => void;
387
388    /**
389     * Trigger a event when the increased button lose focus.
390     *
391     * @type { ?function }
392     * @syscap SystemCapability.ArkUI.ArkUI.Full
393     * @crossplatform
394     * @since 11
395     */
396     /**
397     * Trigger a event when the increased button lose focus.
398     *
399     * @type { ?function }
400     * @syscap SystemCapability.ArkUI.ArkUI.Full
401     * @crossplatform
402     * @atomicservice
403     * @since 12
404     */
405    onBlurIncrease?: () => void;
406
407    /**
408     * Trigger a event when the decreased button lose focus.
409     *
410     * @type { ?function }
411     * @syscap SystemCapability.ArkUI.ArkUI.Full
412     * @crossplatform
413     * @since 11
414     */
415     /**
416     * Trigger a event when the decreased button lose focus.
417     *
418     * @type { ?function }
419     * @syscap SystemCapability.ArkUI.ArkUI.Full
420     * @crossplatform
421     * @atomicservice
422     * @since 12
423     */
424    onBlurDecrease?: () => void;
425}
426
427/**
428 * Defines the date data.
429 *
430 * @syscap SystemCapability.ArkUI.ArkUI.Full
431 * @crossplatform
432 * @since 11
433 */
434 /**
435 * Defines the date data.
436 *
437 * @syscap SystemCapability.ArkUI.ArkUI.Full
438 * @crossplatform
439 * @atomicservice
440 * @since 12
441 */
442declare class DateData {
443    /**
444     * The year of the DateData, ranges from 1 to 5000.
445     *
446     * @type { number }
447     * @syscap SystemCapability.ArkUI.ArkUI.Full
448     * @crossplatform
449     * @since 11
450     */
451     /**
452     * The year of the DateData, ranges from 1 to 5000.
453     *
454     * @type { number }
455     * @syscap SystemCapability.ArkUI.ArkUI.Full
456     * @crossplatform
457     * @atomicservice
458     * @since 12
459     */
460    year: number;
461
462    /**
463     * The month of the DateData.
464     *
465     * @type { number }
466     * @syscap SystemCapability.ArkUI.ArkUI.Full
467     * @crossplatform
468     * @since 11
469     */
470     /**
471     * The month of the DateData.
472     *
473     * @type { number }
474     * @syscap SystemCapability.ArkUI.ArkUI.Full
475     * @crossplatform
476     * @atomicservice
477     * @since 12
478     */
479    month: number;
480
481    /**
482     * The day of the DateData.
483     *
484     * @type { number }
485     * @syscap SystemCapability.ArkUI.ArkUI.Full
486     * @crossplatform
487     * @since 11
488     */
489     /**
490     * The day of the DateData.
491     *
492     * @type { number }
493     * @syscap SystemCapability.ArkUI.ArkUI.Full
494     * @crossplatform
495     * @atomicservice
496     * @since 12
497     */
498    day: number;
499
500    /**
501     * Constructor of the DateData.
502     *
503     * @param { number } year - set the year of the DateData.
504     * @param { number } month - set the month of the DateData.
505     * @param { number } day - set the day of the DateData.
506     * @syscap SystemCapability.ArkUI.ArkUI.Full
507     * @crossplatform
508     * @since 11
509     */
510     /**
511     * Constructor of the DateData.
512     *
513     * @param { number } year - set the year of the DateData.
514     * @param { number } month - set the month of the DateData.
515     * @param { number } day - set the day of the DateData.
516     * @syscap SystemCapability.ArkUI.ArkUI.Full
517     * @crossplatform
518     * @atomicservice
519     * @since 12
520     */
521    constructor(year: number, month: number, day: number);
522
523    /**
524     * Convert the date data to string.
525     *
526     * @returns { string } date data in string form.
527     * @syscap SystemCapability.ArkUI.ArkUI.Full
528     * @crossplatform
529     * @since 11
530     */
531     /**
532     * Convert the date data to string.
533     *
534     * @returns { string } date data in string form.
535     * @syscap SystemCapability.ArkUI.ArkUI.Full
536     * @crossplatform
537     * @atomicservice
538     * @since 12
539     */
540    toString(): string;
541}
542
543/**
544 * Defines the date style options.
545 *
546 * @syscap SystemCapability.ArkUI.ArkUI.Full
547 * @crossplatform
548 * @since 11
549 */
550 /**
551 * Defines the date style options.
552 *
553 * @syscap SystemCapability.ArkUI.ArkUI.Full
554 * @crossplatform
555 * @atomicservice
556 * @since 12
557 */
558declare class DateStyleOptions extends CommonOptions {
559    /**
560     * Set the year of the counter component, ranges from 1 to 5000.
561     *
562     * @type { ?number }
563     * @default 1
564     * @syscap SystemCapability.ArkUI.ArkUI.Full
565     * @crossplatform
566     * @since 11
567     */
568     /**
569     * Set the year of the counter component, ranges from 1 to 5000.
570     *
571     * @type { ?number }
572     * @default 1
573     * @syscap SystemCapability.ArkUI.ArkUI.Full
574     * @crossplatform
575     * @atomicservice
576     * @since 12
577     */
578    year?: number;
579
580    /**
581     * Set the month of the counter component.
582     *
583     * @type { ?number }
584     * @default 1
585     * @syscap SystemCapability.ArkUI.ArkUI.Full
586     * @crossplatform
587     * @since 11
588     */
589     /**
590     * Set the month of the counter component.
591     *
592     * @type { ?number }
593     * @default 1
594     * @syscap SystemCapability.ArkUI.ArkUI.Full
595     * @crossplatform
596     * @atomicservice
597     * @since 12
598     */
599    month?: number;
600
601    /**
602     * Set the day of the counter component.
603     *
604     * @type { ?number }
605     * @default 1
606     * @syscap SystemCapability.ArkUI.ArkUI.Full
607     * @crossplatform
608     * @since 11
609     */
610     /**
611     * Set the day of the counter component.
612     *
613     * @type { ?number }
614     * @default 1
615     * @syscap SystemCapability.ArkUI.ArkUI.Full
616     * @crossplatform
617     * @atomicservice
618     * @since 12
619     */
620    day?: number;
621
622    /**
623     * Trigger a event when the date of the counter has been changed.
624     *
625     * @type { ?function }
626     * @syscap SystemCapability.ArkUI.ArkUI.Full
627     * @crossplatform
628     * @since 11
629     */
630     /**
631     * Trigger a event when the date of the counter has been changed.
632     *
633     * @type { ?function }
634     * @syscap SystemCapability.ArkUI.ArkUI.Full
635     * @crossplatform
636     * @atomicservice
637     * @since 12
638     */
639    onDateChange?: (date: DateData) => void;
640}
641
642
643/**
644 * Defines the counter options.
645 *
646 * @syscap SystemCapability.ArkUI.ArkUI.Full
647 * @crossplatform
648 * @since 11
649 */
650 /**
651 * Defines the counter options.
652 *
653 * @syscap SystemCapability.ArkUI.ArkUI.Full
654 * @crossplatform
655 * @atomicservice
656 * @since 12
657 */
658declare class CounterOptions {
659    /**
660     * Set the type of the counter component.
661     *
662     * @type { CounterType }
663     * @syscap SystemCapability.ArkUI.ArkUI.Full
664     * @crossplatform
665     * @since 11
666     */
667     /**
668     * Set the type of the counter component.
669     *
670     * @type { CounterType }
671     * @syscap SystemCapability.ArkUI.ArkUI.Full
672     * @crossplatform
673     * @atomicservice
674     * @since 12
675     */
676    type: CounterType;
677
678    /**
679     * Set the counter attribute of the LIST or COMPACT counter component.
680     *
681     * @type { ?NumberStyleOptions }
682     * @syscap SystemCapability.ArkUI.ArkUI.Full
683     * @crossplatform
684     * @since 11
685     */
686     /**
687     * Set the counter attribute of the LIST or COMPACT counter component.
688     *
689     * @type { ?NumberStyleOptions }
690     * @syscap SystemCapability.ArkUI.ArkUI.Full
691     * @crossplatform
692     * @atomicservice
693     * @since 12
694     */
695    numberOptions?: NumberStyleOptions;
696
697    /**
698     * Set the counter attribute of the INLINE counter component.
699     *
700     * @type { ?InlineStyleOptions }
701     * @syscap SystemCapability.ArkUI.ArkUI.Full
702     * @crossplatform
703     * @since 11
704     */
705     /**
706     * Set the counter attribute of the INLINE counter component.
707     *
708     * @type { ?InlineStyleOptions }
709     * @syscap SystemCapability.ArkUI.ArkUI.Full
710     * @crossplatform
711     * @atomicservice
712     * @since 12
713     */
714    inlineOptions?: InlineStyleOptions;
715
716    /**
717     * Set the counter attribute of the INLINE_DATE counter component.
718     *
719     * @type { ?DateStyleOptions }
720     * @syscap SystemCapability.ArkUI.ArkUI.Full
721     * @crossplatform
722     * @since 11
723     */
724     /**
725     * Set the counter attribute of the INLINE_DATE counter component.
726     *
727     * @type { ?DateStyleOptions }
728     * @syscap SystemCapability.ArkUI.ArkUI.Full
729     * @crossplatform
730     * @atomicservice
731     * @since 12
732     */
733    dateOptions?: DateStyleOptions;
734
735    /**
736     * Indicates the attribute of the current counter direction.
737     *
738     * @type { ?Direction }
739     * @syscap SystemCapability.ArkUI.ArkUI.Full
740     * @crossplatform
741     * @atomicservice
742     * @since 12
743     */
744    direction?: Direction;
745}
746
747/**
748 * Defines Counter Component.
749 *
750 * @syscap SystemCapability.ArkUI.ArkUI.Full
751 * @crossplatform
752 * @since 11
753 */
754 /**
755 * Defines Counter Component.
756 *
757 * @syscap SystemCapability.ArkUI.ArkUI.Full
758 * @crossplatform
759 * @atomicservice
760 * @since 12
761 */
762@Component
763declare struct CounterComponent {
764    /**
765     * The options of a counter component.
766     *
767     * @type { CounterOptions }
768     * @syscap SystemCapability.ArkUI.ArkUI.Full
769     * @crossplatform
770     * @since 11
771     */
772     /**
773     * The options of a counter component.
774     *
775     * @type { CounterOptions }
776     * @syscap SystemCapability.ArkUI.ArkUI.Full
777     * @crossplatform
778     * @atomicservice
779     * @since 12
780     */
781    @Prop
782    options: CounterOptions;
783}
784
785export {CounterComponent, CounterOptions, DateData, CounterType}
786