• 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 * Called when the start, end and center positions of the display change.
23 *
24 * @typedef { function } ArcScrollIndexHandler
25 * @param { number } start - the start index of the display area.
26 * @param { number } end - the end index of the display area.
27 * @param { number } center - the center index of the display area.
28 * @syscap SystemCapability.ArkUI.ArkUI.Circle
29 * @crossplatform
30 * @atomicservice
31 * @since 18
32 */
33declare type ArcScrollIndexHandler = (start: number, end: number, center: number) => void;
34
35/**
36 * Defines the arc list options.
37 *
38 * @interface ArkListOptions
39 * @syscap SystemCapability.ArkUI.ArkUI.Circle
40 * @crossplatform
41 * @atomicservice
42 * @since 18
43 */
44declare interface ArkListOptions {
45  /**
46   * Describes the index of initial item, the default value is 0.
47   *
48   * @type { ?number }
49   * @syscap SystemCapability.ArkUI.ArkUI.Circle
50   * @crossplatform
51   * @atomicservice
52   * @since 18
53   */
54  initialIndex?: number;
55
56  /**
57   * Describes the controller for scrollable container.
58   *
59   * @type { ?Scroller }
60   * @syscap SystemCapability.ArkUI.ArkUI.Circle
61   * @crossplatform
62   * @atomicservice
63   * @since 18
64   */
65  scroller?: Scroller;
66
67  /**
68   * Describes the header.
69   *
70   * @type { ?ComponentContent }
71   * @syscap SystemCapability.ArkUI.ArkUI.Circle
72   * @crossplatform
73   * @atomicservice
74   * @since 18
75   */
76  header?: ComponentContent;
77}
78
79/**
80 * Defines the arc list component.
81 *
82 * @interface ArcListInterface
83 * @syscap SystemCapability.ArkUI.ArkUI.Circle
84 * @crossplatform
85 * @atomicservice
86 * @since 18
87 */
88export interface ArcListInterface {
89  /**
90   * Creates the arc list component.
91   *
92   * @param { ArkListOptions } [options]
93   * @returns { ArcListAttribute }
94   * @syscap SystemCapability.ArkUI.ArkUI.Circle
95   * @crossplatform
96   * @atomicservice
97   * @since 18
98   */
99  (options?: ArkListOptions): ArcListAttribute;
100}
101
102/**
103 * Defines the arc list item component.
104 *
105 * @interface ArcListItemInterface
106 * @syscap SystemCapability.ArkUI.ArkUI.Circle
107 * @crossplatform
108 * @atomicservice
109 * @since 18
110 */
111export interface ArcListItemInterface {
112  /**
113   * Creates the arc list item component.
114   *
115   * @returns { ArcListItemAttribute }
116   * @syscap SystemCapability.ArkUI.ArkUI.Circle
117   * @crossplatform
118   * @atomicservice
119   * @since 18
120   */
121  (): ArcListItemAttribute;
122}
123
124/**
125 * Defines the arc list attribute functions.
126 *
127 * @extends CommonMethod<ArcListAttribute>
128 * @syscap SystemCapability.ArkUI.ArkUI.Circle
129 * @crossplatform
130 * @atomicservice
131 * @since 18
132 */
133export declare class ArcListAttribute extends CommonMethod<ArcListAttribute> {
134  /**
135   * Set the digital crown sensitivity.
136   *
137   * @param { Optional<CrownSensitivity> } sensitivity
138   * @returns { ArcListAttribute }
139   * @syscap SystemCapability.ArkUI.ArkUI.Circle
140   * @crossplatform
141   * @atomicservice
142   * @since 18
143   */
144  digitalCrownSensitivity(sensitivity: Optional<CrownSensitivity>): ArcListAttribute;
145
146  /**
147   * Set the space between items.
148   *
149   * @param { Optional<LengthMetrics> } space - The space between items.
150   * @returns { ArcListAttribute }
151   * @syscap SystemCapability.ArkUI.ArkUI.Circle
152   * @crossplatform
153   * @atomicservice
154   * @since 18
155   */
156  space(space: Optional<LengthMetrics>): ArcListAttribute;
157
158  /**
159   * Set the display mode of the side slider.
160   *
161   * @param { Optional<BarState> } status
162   * @returns { ArcListAttribute }
163   * @syscap SystemCapability.ArkUI.ArkUI.Circle
164   * @crossplatform
165   * @atomicservice
166   * @since 18
167   */
168  scrollBar(status: Optional<BarState>): ArcListAttribute;
169
170  /**
171   * Color of the scrollbar.
172   *
173   * @param { Optional<ColorMetrics> } color  - Color of the scrollbar.
174   * @returns { ArcListAttribute }
175   * @syscap SystemCapability.ArkUI.ArkUI.Circle
176   * @crossplatform
177   * @atomicservice
178   * @since 18
179   */
180  scrollBarColor(color: Optional<ColorMetrics>): ArcListAttribute;
181
182  /**
183   * Width of the scrollbar.
184   *
185   * @param { Optional<LengthMetrics> } width  - Width of the scrollbar.
186   * @returns { ArcListAttribute }
187   * @syscap SystemCapability.ArkUI.ArkUI.Circle
188   * @crossplatform
189   * @atomicservice
190   * @since 18
191   */
192  scrollBarWidth(width: Optional<LengthMetrics>): ArcListAttribute;
193
194  /**
195   * Set the minimum number of list item caches for long list deferred loading.
196   *
197   * @param { Optional<number> } count
198   * @returns { ArcListAttribute }
199   * @syscap SystemCapability.ArkUI.ArkUI.Circle
200   * @crossplatform
201   * @atomicservice
202   * @since 18
203   */
204  cachedCount(count: Optional<number>): ArcListAttribute;
205
206  /**
207   * Whether to enable chain linkage dynamic effect.
208   *
209   * @param { Optional<boolean> } enable
210   * @returns { ArcListAttribute }
211   * @syscap SystemCapability.ArkUI.ArkUI.Circle
212   * @crossplatform
213   * @atomicservice
214   * @since 18
215   */
216  chainAnimation(enable: Optional<boolean>): ArcListAttribute;
217
218  /**
219   * Set the children main size for arc list.
220   *
221   * @param { Optional<ChildrenMainSize> } size - children main size for arc list
222   * @returns { ArcListAttribute }
223   * @syscap SystemCapability.ArkUI.ArkUI.Circle
224   * @crossplatform
225   * @atomicservice
226   * @since 18
227   */
228  childrenMainSize(size: Optional<ChildrenMainSize>): ArcListAttribute;
229
230  /**
231   * Whether to enable scroll by gesture or mouse.
232   *
233   * @param { Optional<boolean> } enable
234   * @returns { ArcListAttribute }
235   * @syscap SystemCapability.ArkUI.ArkUI.Circle
236   * @crossplatform
237   * @atomicservice
238   * @since 18
239   */
240  enableScrollInteraction(enable: Optional<boolean>): ArcListAttribute;
241
242  /**
243   * Whether to enable fading Edge effect.
244   *
245   * @param { Optional<boolean> } enable
246   * @returns { ArcListAttribute }
247   * @syscap SystemCapability.ArkUI.ArkUI.Circle
248   * @crossplatform
249   * @atomicservice
250   * @since 18
251   */
252  fadingEdge(enable: Optional<boolean>): ArcListAttribute;
253
254  /**
255   * Friction coefficient.
256   *
257   * @param { Optional<number> } friction - friction coefficient.
258   * @returns { ArcListAttribute }
259   * @syscap SystemCapability.ArkUI.ArkUI.Circle
260   * @crossplatform
261   * @atomicservice
262   * @since 18
263   */
264  friction(friction: Optional<number>): ArcListAttribute;
265
266  /**
267   * Limit the max speed when fling.
268   *
269   * @param { Optional<number> } speed - Max fling speed, the value needs to be a positive number, the maximum value is not limited.
270   *                             The unit is vp/s.
271   * @returns { ArcListAttribute }
272   * @syscap SystemCapability.ArkUI.ArkUI.Circle
273   * @crossplatform
274   * @atomicservice
275   * @since 18
276   */
277  flingSpeedLimit(speed: Optional<number>): ArcListAttribute;
278
279  /**
280   * Called when the start, end and center positions of the display change.
281   *
282   * @param { Optional<ArcScrollIndexHandler> } handler
283   * @returns { ArcListAttribute }
284   * @syscap SystemCapability.ArkUI.ArkUI.Circle
285   * @crossplatform
286   * @atomicservice
287   * @since 18
288   */
289  onScrollIndex(handler: Optional<ArcScrollIndexHandler>): ArcListAttribute;
290
291  /**
292   * Called when the list begins to arrive.
293   *
294   * @param { Optional<VoidCallback> } handler
295   * @returns { ArcListAttribute }
296   * @syscap SystemCapability.ArkUI.ArkUI.Circle
297   * @crossplatform
298   * @atomicservice
299   * @since 18
300   */
301  onReachStart(handler: Optional<VoidCallback>): ArcListAttribute;
302
303  /**
304   * Called when the list reaches the end.
305   *
306   * @param { Optional<VoidCallback> } handler
307   * @returns { ArcListAttribute }
308   * @syscap SystemCapability.ArkUI.ArkUI.Circle
309   * @crossplatform
310   * @atomicservice
311   * @since 18
312   */
313  onReachEnd(handler: Optional<VoidCallback>): ArcListAttribute;
314
315  /**
316   * Called when the slider start.
317   *
318   * @param { Optional<VoidCallback> } handler
319   * @returns { ArcListAttribute }
320   * @syscap SystemCapability.ArkUI.ArkUI.Circle
321   * @crossplatform
322   * @atomicservice
323   * @since 18
324   */
325  onScrollStart(handler: Optional<VoidCallback>): ArcListAttribute;
326
327  /**
328   * Called when the slider stops.
329   *
330   * @param { Optional<VoidCallback> } handler
331   * @returns { ArcListAttribute }
332   * @syscap SystemCapability.ArkUI.ArkUI.Circle
333   * @crossplatform
334   * @atomicservice
335   * @since 18
336   */
337  onScrollStop(handler: Optional<VoidCallback>): ArcListAttribute;
338
339  /**
340   * Called when the scrollable will scroll.
341   *
342   * @param { Optional<OnWillScrollCallback> } handler - callback of scrollable.
343   * @returns { ArcListAttribute }
344   * @syscap SystemCapability.ArkUI.ArkUI.Circle
345   * @crossplatform
346   * @atomicservice
347   * @since 18
348   */
349  onWillScroll(handler: Optional<OnWillScrollCallback>): ArcListAttribute;
350
351  /**
352   * Called when the scrollable did scroll.
353   *
354   * @param { Optional<OnScrollCallback> } handler - callback of scrollable,
355   * scrollOffset is offset this frame did scroll, scrollState is current scroll state.
356   * @returns { ArcListAttribute }
357   * @syscap SystemCapability.ArkUI.ArkUI.Circle
358   * @crossplatform
359   * @atomicservice
360   * @since 18
361   */
362  onDidScroll(handler: Optional<OnScrollCallback>): ArcListAttribute;
363}
364
365/**
366 * Defines the arc list item attribute functions.
367 *
368 * @extends CommonMethod<ArcListItemAttribute>
369 * @syscap SystemCapability.ArkUI.ArkUI.Circle
370 * @crossplatform
371 * @atomicservice
372 * @since 18
373 */
374export declare class ArcListItemAttribute extends CommonMethod<ArcListItemAttribute> {
375  /**
376   * Whether to enable auto scale when layout.
377   *
378   * @param { Optional<boolean> } enable
379   * @returns { ArcListItemAttribute }
380   * @syscap SystemCapability.ArkUI.ArkUI.Circle
381   * @crossplatform
382   * @atomicservice
383   * @since 18
384   */
385  autoScale(enable: Optional<boolean>): ArcListItemAttribute;
386
387  /**
388   * Sets the action item that appears when the list item slides in the cross axis direction of the list.
389   *
390   * @param { Optional<SwipeActionOptions> } options - items defines in the SwipeActionOption.
391   * @returns { ArcListItemAttribute }
392   * @syscap SystemCapability.ArkUI.ArkUI.Circle
393   * @crossplatform
394   * @atomicservice
395   * @since 18
396   */
397  swipeAction(options: Optional<SwipeActionOptions>): ArcListItemAttribute;
398}
399
400/**
401 * Defines ArcList Component instance.
402 *
403 * @syscap SystemCapability.ArkUI.ArkUI.Circle
404 * @crossplatform
405 * @atomicservice
406 * @since 18
407 */
408export declare const ArcListInstance: ArcListAttribute;
409
410/**
411 * Defines ArcListItem Component instance.
412 *
413 * @syscap SystemCapability.ArkUI.ArkUI.Circle
414 * @crossplatform
415 * @atomicservice
416 * @since 18
417 */
418export declare const ArcListItemInstance: ArcListItemAttribute;
419
420/**
421 * Defines ArcList Component.
422 *
423 * @syscap SystemCapability.ArkUI.ArkUI.Circle
424 * @crossplatform
425 * @atomicservice
426 * @since 18
427 */
428/**
429 * Defines ArcList Component.
430 *
431 * @syscap SystemCapability.ArkUI.ArkUI.Circle
432 * @crossplatform
433 * @atomicservice
434 * @uicomponent
435 * @since 19
436 */
437export declare const ArcList: ArcListInterface;
438
439/**
440 * Defines ArcListItem Component.
441 *
442 * @syscap SystemCapability.ArkUI.ArkUI.Circle
443 * @crossplatform
444 * @atomicservice
445 * @since 18
446 */
447/**
448 * Defines ArcListItem Component.
449 *
450 * @syscap SystemCapability.ArkUI.ArkUI.Circle
451 * @crossplatform
452 * @atomicservice
453 * @uicomponent
454 * @since 19
455 */
456export declare const ArcListItem: ArcListItemInterface;