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 * Provides methods for switching components. 18 * @since 7 19 */ 20declare class SwiperController { 21 /** 22 * constructor. 23 * @since 7 24 */ 25 constructor(); 26 27 /** 28 * Called when the next child component is displayed. 29 * @since 7 30 */ 31 showNext(); 32 33 /** 34 * Called when the previous subcomponent is displayed. 35 * @since 7 36 */ 37 showPrevious(); 38 39 /** 40 * Called when need to stop the swiper animation. 41 * @since 7 42 */ 43 finishAnimation(callback?: () => void); 44} 45 46/** 47 * Declare the size of the swiper on the spindle. 48 * @since 7 49 */ 50declare enum SwiperDisplayMode { 51 /** 52 * Carousel map extension. 53 * @since 7 54 */ 55 Stretch, 56 57 /** 58 * The rotation chart is self linear. 59 * @since 7 60 */ 61 AutoLinear, 62} 63 64/** 65 * Provides an interface for sliding containers. 66 * @since 7 67 */ 68interface SwiperInterface { 69 /** 70 * Called when a sliding container is set. 71 * @since 7 72 */ 73 (controller?: SwiperController): SwiperAttribute; 74} 75 76/** 77 * Setting indicator style navigation. 78 * @since 8 79 */ 80declare interface IndicatorStyle { 81 /** 82 * Set the indicator to the left. 83 * @since 8 84 */ 85 left?: Length; 86 87 /** 88 * Set the indicator to the top. 89 * @since 8 90 */ 91 top?: Length; 92 93 /** 94 * Set the indicator to the right. 95 * @since 8 96 */ 97 right?: Length; 98 99 /** 100 * Set the indicator to the bottom. 101 * @since 8 102 */ 103 bottom?: Length; 104 105 /** 106 * Set the indicator size. 107 * @since 8 108 */ 109 size?: Length; 110 111 /** 112 * Setting indicator style mask. 113 * @since 8 114 */ 115 mask?: boolean; 116 117 /** 118 * Set the indicator color. 119 * @since 8 120 */ 121 color?: ResourceColor; 122 123 /** 124 * Set the navigation point color. 125 * @since 8 126 */ 127 selectedColor?: ResourceColor; 128} 129 130/** 131 * Defines the swiper attribute functions. 132 * @since 7 133 */ 134declare class SwiperAttribute extends CommonMethod<SwiperAttribute> { 135 /** 136 * Called when the index value of the displayed subcomponent is set in the container. 137 * @since 7 138 */ 139 index(value: number): SwiperAttribute; 140 141 /** 142 * Called when setting whether the subcomponent plays automatically. 143 * @since 7 144 */ 145 autoPlay(value: boolean): SwiperAttribute; 146 147 /** 148 * Called when the time interval for automatic playback is set. 149 * @since 7 150 */ 151 interval(value: number): SwiperAttribute; 152 153 /** 154 * Called when you set whether the navigation point indicator is enabled. 155 * @since 7 156 */ 157 indicator(value: boolean): SwiperAttribute; 158 159 /** 160 * Called when setting whether to turn on cyclic sliding. 161 * @since 7 162 */ 163 loop(value: boolean): SwiperAttribute; 164 165 /** 166 * Called when the animation duration of the switch is set. 167 * @since 7 168 */ 169 duration(value: number): SwiperAttribute; 170 171 /** 172 * Called when setting whether to slide vertically. 173 * @since 7 174 */ 175 vertical(value: boolean): SwiperAttribute; 176 177 /** 178 * Called when the size of the rotation chart is set. 179 * @since 7 180 */ 181 itemSpace(value: number | string): SwiperAttribute; 182 183 /** 184 * Called when setting the size of the swiper container on the spindle. 185 * @since 7 186 */ 187 displayMode(value: SwiperDisplayMode): SwiperAttribute; 188 189 /** 190 * Called when setting the cached count of the swiper container one side. 191 * @since 8 192 */ 193 cachedCount(value: number): SwiperAttribute; 194 195 /** 196 * This command is invoked when the number of subcomponents is set. 197 * @since 8 198 */ 199 displayCount(value: number | string): SwiperAttribute; 200 201 /** 202 * Invoked when setting the sliding effect 203 * @since 8 204 */ 205 effectMode(value: EdgeEffect): SwiperAttribute; 206 207 /** 208 * Called when sliding is disableSwipe 209 * @since 8 210 */ 211 disableSwipe(value: boolean): SwiperAttribute; 212 213 /** 214 * Called when sliding is curve 215 * @since 8 216 */ 217 curve(value: Curve | string): SwiperAttribute; 218 /** 219 * Called when the index value changes. 220 * @since 7 221 */ 222 onChange(event: (index: number) => void): SwiperAttribute; 223 224 /** 225 * Setting indicator style navigation. 226 * @since 8 227 */ 228 indicatorStyle(value?: IndicatorStyle): SwiperAttribute; 229 230 /** 231 * Called when the swiper animation start. 232 * @param { number } index - the index value of the swiper page that when animation start. 233 * @syscap SystemCapability.ArkUI.ArkUI.Full 234 * @since 9 235 */ 236 onAnimationStart(event: (index: number) => void): SwiperAttribute; 237 238 /** 239 * Called when the swiper animation end. 240 * @param { number } index - the index value of the swiper page that when animation end. 241 * @syscap SystemCapability.ArkUI.ArkUI.Full 242 * @since 9 243 */ 244 onAnimationEnd(event: (index: number) => void): SwiperAttribute; 245} 246 247/** 248 * Defines Swiper Component. 249 * @since 7 250 */ 251declare const Swiper: SwiperInterface; 252 253/** 254 * Defines Swiper Component instance. 255 * @since 7 256 */ 257declare const SwiperInstance: SwiperAttribute; 258