• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2021 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 * Defines the badge position property.
18 * @since 7
19 */
20declare enum BadgePosition {
21  /**
22   * The dot is displayed vertically centered on the right.
23   * @since 7
24   */
25  RightTop,
26
27  /**
28   * Dots are displayed in the upper right corner.
29   * @since 7
30   */
31  Right,
32
33  /**
34   * The dot is displayed in the left vertical center.
35   * @since 7
36   */
37  Left,
38}
39
40/**
41 * BadgeStyle object
42 * @since 7
43 */
44declare interface BadgeStyle {
45  /**
46   * Text Color
47   * @since 7
48   */
49  color?: ResourceColor;
50
51  /**
52   * Text size.
53   * @since 7
54   */
55  fontSize?: number | string;
56
57  /**
58   * Size of a badge.
59   * @since 7
60   */
61  badgeSize?: number | string;
62
63  /**
64   * Color of the badge.
65   * @since 7
66   */
67  badgeColor?: ResourceColor;
68}
69
70/**
71 * Defines the base param of badge.
72 * @since 7
73 */
74declare interface BadgeParam {
75  /**
76   * Set the display position of the prompt point.
77   * @since 7
78   */
79  position?: BadgePosition;
80
81  /**
82   * Defines the style of the Badge component, including the text color, size, dot color, and size.
83   * @since 7
84   */
85  style: BadgeStyle;
86}
87
88/**
89 * Defines the badge param with count and maxCount.
90 * @since 7
91 */
92declare interface BadgeParamWithNumber extends BadgeParam {
93  /**
94   * Set the number of reminder messages.
95   * @since 7
96   */
97  count: number;
98
99  /**
100   * Maximum number of messages. If the number of messages exceeds the maximum, only maxCount+ is displayed.
101   * @since 7
102   */
103  maxCount?: number;
104}
105
106/**
107 * Defines the badge param with string value.
108 * @since 7
109 */
110declare interface BadgeParamWithString extends BadgeParam {
111  /**
112   * Text string of the prompt content.
113   * @since 7
114   */
115  value: string;
116}
117
118/**
119 * Defines Badge Componrnt.
120 * @since 7
121 */
122interface BadgeInterface {
123  /**
124   * position: Set the display position of the prompt point.
125   * maxCount: Maximum number of messages. If the number of messages exceeds the maximum, only maxCount+ is displayed.
126   * count: Set the number of reminder messages.
127   * style: You can set the style of the Badge component, including the text color, size, dot color, and size.
128   * @since 7
129   */
130  (value: BadgeParamWithNumber): BadgeAttribute;
131
132  /**
133   * value: Text string of the prompt content.
134   * position: Set the display position of the prompt point.
135   * maxCount: Maximum number of messages. If the number of messages exceeds the maximum, only maxCount+ is displayed.
136   * style: You can set the style of the Badge component, including the text color, size, dot color, and size.
137   * @since 7
138   */
139  (value: BadgeParamWithString): BadgeAttribute;
140}
141
142/**
143 * Defines Badge Componrnt attribute.
144 * @since 7
145 */
146declare class BadgeAttribute extends CommonMethod<BadgeAttribute> {}
147
148declare const Badge: BadgeInterface;
149declare const BadgeInstance: BadgeAttribute;
150