• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2021-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 * Declare sliderstyle
18 * @since 7
19 */
20/**
21 * Declare sliderstyle
22 * @form
23 * @since 9
24 */
25declare enum SliderStyle {
26  /**
27   * The slider is on the slide rail.
28   * @since 7
29   */
30  /**
31   * The slider is on the slide rail.
32   * @form
33   * @since 9
34   */
35  OutSet,
36
37  /**
38   * The slider is in the slide rail.
39   * @since 7
40   */
41  /**
42   * The slider is in the slide rail.
43   * @form
44   * @since 9
45   */
46  InSet,
47}
48
49/**
50 * Declare SliderChangeMode
51 * @since 7
52 */
53/**
54 * Declare SliderChangeMode
55 * @form
56 * @since 9
57 */
58declare enum SliderChangeMode {
59  /**
60   * Start dragging the slider.
61   * @since 7
62   */
63  /**
64   * Start dragging the slider.
65   * @form
66   * @since 9
67   */
68  Begin,
69
70  /**
71   * Drag the slider.
72   * @since 7
73   */
74  /**
75   * Drag the slider.
76   * @form
77   * @since 9
78   */
79  Moving,
80
81  /**
82   * End dragging the slider.
83   * @since 7
84   */
85  /**
86   * End dragging the slider.
87   * @form
88   * @since 9
89   */
90  End,
91
92  /**
93   * Click the slider.
94   * @since 8
95   */
96  /**
97   * Click the slider.
98   * @form
99   * @since 9
100   */
101  Click,
102}
103
104/**
105 * Defines the options of Slider.
106 * @since 7
107 */
108/**
109 * Defines the options of Slider.
110 * @form
111 * @since 9
112 */
113declare interface SliderOptions {
114  /**
115   * Current value of Slider.
116   * @since 7
117   */
118  /**
119   * Current value of Slider.
120   * @form
121   * @since 9
122   */
123  value?: number;
124
125  /**
126   * Sets the min value of Slider.
127   * @since 7
128   */
129  /**
130   * Sets the min value of Slider.
131   * @form
132   * @since 9
133   */
134  min?: number;
135
136  /**
137   * Sets the max value of Slider.
138   * @since 7
139   */
140  /**
141   * Sets the max value of Slider.
142   * @form
143   * @since 9
144   */
145  max?: number;
146
147  /**
148   * Sets the step of each slide value.
149   * @since 7
150   */
151  /**
152   * Sets the step of each slide value.
153   * @form
154   * @since 9
155   */
156  step?: number;
157
158  /**
159   * Sets the slider style.
160   * @since 7
161   */
162  /**
163   * Sets the slider style.
164   * @form
165   * @since 9
166   */
167  style?: SliderStyle;
168
169  /**
170   * Sets the slider direction style.
171   * @since 8
172   */
173  /**
174   * Sets the slider direction style.
175   * @form
176   * @since 9
177   */
178  direction?: Axis;
179
180  /**
181   * Set whether the direction of the slider needs to be reversed.
182   * @since 8
183   */
184  /**
185   * Set whether the direction of the slider needs to be reversed.
186   * @form
187   * @since 9
188   */
189  reverse?: boolean;
190}
191
192/**
193 * Provides an interface for the slide bar component.
194 * @since 7
195 */
196/**
197 * Provides an interface for the slide bar component.
198 * @form
199 * @since 9
200 */
201interface SliderInterface {
202  /**
203   * Called when the slider bar component is used.
204   * @since 7
205   */
206  /**
207   * Called when the slider bar component is used.
208   * @form
209   * @since 9
210   */
211  (options?: SliderOptions): SliderAttribute;
212}
213
214/**
215 * Defines the attribute functions of Slider.
216 * @since 7
217 */
218/**
219 * Defines the attribute functions of Slider.
220 * @form
221 * @since 9
222 */
223declare class SliderAttribute extends CommonMethod<SliderAttribute> {
224  /**
225   * Called when the slider color of the slider bar is set.
226   * @since 7
227   */
228  /**
229   * Called when the slider color of the slider bar is set.
230   * @form
231   * @since 9
232   */
233  blockColor(value: ResourceColor): SliderAttribute;
234
235  /**
236   * Called when the track color of the slider is set.
237   * @since 7
238   */
239  /**
240   * Called when the track color of the slider is set.
241   * @form
242   * @since 9
243   */
244  trackColor(value: ResourceColor): SliderAttribute;
245
246  /**
247   * Called when the slider of the slider bar is set to slide over the area color.
248   * @since 7
249   */
250  /**
251   * Called when the slider of the slider bar is set to slide over the area color.
252   * @form
253   * @since 9
254   */
255  selectedColor(value: ResourceColor): SliderAttribute;
256
257  /**
258   * Called when the minimum label is set.
259   * @since 7
260   * @deprecated since 9
261   * @useinstead min
262   */
263  minLabel(value: string): SliderAttribute;
264
265  /**
266   * Called when the maximum label is set.
267   * @since 7
268   * @deprecated since 9
269   * @useinstead max
270   */
271  maxLabel(value: string): SliderAttribute;
272
273  /**
274   * Called when setting whether to display step size.
275   * @since 7
276   */
277  /**
278   * Called when setting whether to display step size.
279   * @form
280   * @since 9
281   */
282  showSteps(value: boolean): SliderAttribute;
283
284  /**
285   * Called when the percentage of bubble prompt is set when sliding.
286   * @since 7
287   */
288  /**
289   * Called when the percentage of bubble prompt is set when sliding.
290   * @form
291   * @since 9
292   */
293  showTips(value: boolean): SliderAttribute;
294
295  /**
296   * Called when the thickness of track is set.
297   * @since 8
298   */
299  /**
300   * Called when the thickness of track is set.
301   * @form
302   * @since 9
303   */
304  trackThickness(value: Length): SliderAttribute;
305
306  /**
307   * Called when the selection value changes.
308   * @since 7
309   */
310  /**
311   * Called when the selection value changes.
312   * @form
313   * @since 9
314   */
315  onChange(callback: (value: number, mode: SliderChangeMode) => void): SliderAttribute;
316}
317
318/**
319 * Defines Slider Component.
320 * @since 7
321 */
322/**
323 * Defines Slider Component.
324 * @form
325 * @since 9
326 */
327declare const Slider: SliderInterface;
328
329/**
330 * Defines Slider Component instance.
331 * @since 7
332 */
333/**
334 * Defines Slider Component instance.
335 * @form
336 * @since 9
337 */
338declare const SliderInstance: SliderAttribute;
339