1/* 2 * Copyright (c) 2024-2025 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 * @file 17 * @kit ArkUI 18 * @arkts 1.2 19 */ 20 21 22// WARNING! THIS FILE IS AUTO-GENERATED, DO NOT MAKE CHANGES, THEY WILL BE LOST ON NEXT GENERATION! 23 24import { memo, ComponentBuilder, __memo_context_type, __memo_id_type } from './../stateManagement/runtime' 25import { LengthMetrics } from './../Graphics' 26import { Curve, Axis, Edge, HitTestMode, ImageSize, Alignment, BorderStyle, ColoringStrategy, HoverEffect, Color, Visibility, ItemAlign, Direction, GradientDirection, ObscuredReasons, RenderFit, ImageRepeat, ResponseType, FunctionKey, ModifierKey, BarState, EdgeEffect, ScrollSource } from './enums' 27import { ICurve, RectResult, ScrollableCommonMethod, CommonMethod, DrawModifier, Rectangle, Callback_Array_TouchTestInfo_TouchResult, TouchTestInfo, TouchResult, PixelRoundPolicy, BackgroundEffectOptions, ForegroundEffectOptions, BorderImageOption, OutlineStyle, Callback_ClickEvent_Void, ClickEvent, Callback_Boolean_HoverEvent_Void, HoverEvent, AccessibilityCallback, Callback_MouseEvent_Void, MouseEvent, Callback_TouchEvent_Void, TouchEvent, Callback_KeyEvent_Void, KeyEvent, Callback_KeyEvent_Boolean, AnimateParam, TransitionOptions, TransitionEffect, MotionBlurOptions, InvertOptions, TranslateOptions, ScaleOptions, RotateOptions, Callback_Area_Area_Void, Literal_Union_Number_Literal_Number_offset_span_lg_md_sm_xs, Literal_Number_offset_span, AlignRuleOption, LocalizedAlignRuleOptions, ClickEffect, Callback_DragEvent_String_Union_CustomBuilder_DragItemInfo, DragEvent, CustomBuilder, DragItemInfo, Callback_DragEvent_String_Void, Callback_PreDragStatus_Void, PreDragStatus, Type_CommonMethod_linearGradient_value, Tuple_ResourceColor_Number, Type_CommonMethod_sweepGradient_value, Tuple_Length_Length, Type_CommonMethod_radialGradient_value, MotionPathOptions, ShadowOptions, ShadowStyle, ProgressMask, StateStyles, PixelStretchEffectOptions, AttributeModifier, GestureModifier, BackgroundBrightnessOptions, Callback_GestureInfo_BaseGestureEvent_GestureJudgeResult, GestureRecognizerJudgeBeginCallback, ShouldBuiltInRecognizerParallelWithCallback, Callback_TouchEvent_HitTestMode, SizeChangeCallback, SafeAreaType, SafeAreaEdge, Literal_Alignment_align, BlurStyle, BackgroundBlurStyleOptions, ForegroundBlurStyleOptions, TransitionFinishCallback, BlurOptions, LinearGradientBlurOptions, EffectType, sharedTransitionOptions, ChainStyle, DragPreviewOptions, DragInteractionOptions, OverlayOptions, BlendMode, BlendApplyType, GeometryTransitionOptions, PopupOptions, CustomPopupOptions, MenuElement, MenuOptions, ContextMenuOptions, ModalTransition, ContentCoverOptions, SheetOptions, VisibleAreaChangeCallback, NestedScrollOptions, ContentClipMode, EdgeEffectOptions, FadingEdgeOptions } from './common' 28import { Dimension, Length, VisualEffect, Filter, UniformDataType, Blender, SizeOptions, ConstraintSizeOptions, ChainWeightOptions, Padding, LocalizedPadding, Margin, LocalizedMargin, ResourceColor, Position, BorderOptions, EdgeStyles, EdgeWidths, LocalizedEdgeWidths, EdgeColors, LocalizedEdgeColors, BorderRadiuses, LocalizedBorderRadiuses, OutlineOptions, EdgeOutlineStyles, EdgeOutlineWidths, OutlineRadiuses, Area, Edges, LocalizedEdges, LocalizedPosition, ResourceStr, AccessibilityOptions, VoidCallback, PixelMap } from './units' 29import { ScrollSnapAlign, ScrollState } from './list' 30import { ComponentContent } from './../ComponentContent' 31import { CircleShape, EllipseShape, PathShape, RectShape } from './../../../api/@ohos.arkui.shape' 32import { ResizableOptions } from './image' 33import { Resource } from './../../../api/global/resource' 34 35 36import { GestureInfo, BaseGestureEvent, GestureJudgeResult, GestureType, GestureMask } from './gesture' 37import { Callback_Number_Number_Void } from './grid' 38export enum ScrollDirection { 39 VERTICAL = 0, 40 Vertical = 0, 41 HORIZONTAL = 1, 42 Horizontal = 1, 43 FREE = 2, 44 Free = 2, 45 NONE = 3, 46 None = 3 47} 48export enum ScrollAlign { 49 START = 0, 50 CENTER = 1, 51 END = 2, 52 AUTO = 3 53} 54export interface OffsetResult { 55 xOffset: number; 56 yOffset: number; 57} 58export interface ScrollEdgeOptions { 59 velocity?: number; 60} 61export interface ScrollToIndexOptions { 62 extraOffset?: LengthMetrics; 63} 64export interface ScrollAnimationOptions { 65 duration?: number; 66 curve?: Curve | ICurve; 67 canOverScroll?: boolean; 68} 69export interface OffsetOptions { 70 xOffset?: Dimension; 71 yOffset?: Dimension; 72} 73export interface Literal_Boolean_next_Axis_direction { 74 next: boolean; 75 direction?: Axis; 76} 77export declare class Scroller { 78 scrollTo(options: ScrollOptions): undefined 79 scrollEdge(value: Edge, options?: ScrollEdgeOptions): undefined 80 fling(velocity: number): void 81 scrollPage(value: ScrollPageOptions): undefined 82 83 currentOffset(): OffsetResult 84 scrollToIndex(value: number, smooth?: boolean, align?: ScrollAlign, options?: ScrollToIndexOptions): undefined 85 scrollBy(dx: Length, dy: Length): undefined 86 isAtEnd(): boolean 87 getItemRect(index: number): RectResult 88 getItemIndex(x: number, y: number): number 89} 90export interface ScrollOptions { 91 xOffset: number | string; 92 yOffset: number | string; 93 animation?: ScrollAnimationOptions | boolean; 94} 95export interface ScrollPageOptions { 96 next: boolean; 97 animation?: boolean; 98} 99export interface ScrollSnapOptions { 100 snapAlign: ScrollSnapAlign; 101 snapPagination?: Dimension | Array<Dimension>; 102 enableSnapToStart?: boolean; 103 enableSnapToEnd?: boolean; 104} 105export type ScrollInterface = (scroller?: Scroller) => ScrollAttribute; 106export type OnScrollEdgeCallback = (side: Edge) => void; 107export interface OnScrollFrameBeginHandlerResult { 108 offsetRemain: number; 109} 110export type OnScrollFrameBeginCallback = (offset: number, state: ScrollState) => OnScrollFrameBeginHandlerResult; 111export interface ScrollAttribute extends ScrollableCommonMethod { 112 @memo 113 scrollable(value: ScrollDirection): this; 114 @memo 115 onScroll(value: ((first: number,last: number) => void)): this; 116 @memo 117 onWillScroll(value: ScrollOnWillScrollCallback | undefined): this; 118 @memo 119 onDidScroll(value: ScrollOnScrollCallback): this; 120 @memo 121 onScrollEdge(value: OnScrollEdgeCallback): this; 122 @memo 123 onScrollStart(value: VoidCallback): this; 124 @memo 125 onScrollEnd(value: (() => void)): this; 126 @memo 127 onScrollStop(value: VoidCallback): this; 128 @memo 129 scrollBar(value: BarState): this; 130 @memo 131 scrollBarColor(value: Color | number | string): this; 132 @memo 133 scrollBarWidth(value: number | string): this; 134 @memo 135 onScrollFrameBegin(value: OnScrollFrameBeginCallback): this; 136 @memo 137 nestedScroll(value: NestedScrollOptions): this; 138 @memo 139 enableScrollInteraction(value: boolean): this; 140 @memo 141 friction(value: number | Resource): this; 142 @memo 143 scrollSnap(value: ScrollSnapOptions): this; 144 @memo 145 enablePaging(value: boolean): this; 146 @memo 147 initialOffset(value: OffsetOptions): this; 148} 149export type ScrollOnScrollCallback = (scrollOffset: number, scrollState: ScrollState) => void; 150export type ScrollOnWillScrollCallback = (xOffset: number, yOffset: number, scrollState: ScrollState, 151 scrollSource: ScrollSource) => OffsetResult; 152@memo 153@ComponentBuilder 154export declare function Scroll( 155 scroller?: Scroller | undefined, 156 @memo 157 content_?: () => void, 158): ScrollAttribute 159