@ehmetlabs/webf-react-carousel-slider 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +626 -0
- package/dist/index.d.ts +626 -0
- package/dist/index.js +193 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +162 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +29 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,626 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { WebFElementWithMethods } from '@openwebf/react-core-ui';
|
|
3
|
+
|
|
4
|
+
declare enum CenterPageEnlargeStrategy$1 {
|
|
5
|
+
scale = "scale",
|
|
6
|
+
height = "height",
|
|
7
|
+
zoom = "zoom"
|
|
8
|
+
}
|
|
9
|
+
declare enum Axis$1 {
|
|
10
|
+
horizontal = "Axis.horizontal",
|
|
11
|
+
vertical = "Axis.vertical"
|
|
12
|
+
}
|
|
13
|
+
declare enum Curve$1 {
|
|
14
|
+
ease = "Curves.ease",
|
|
15
|
+
easeIn = "Curves.easeIn",
|
|
16
|
+
easeOut = "Curves.easeOut",
|
|
17
|
+
easeInOut = "Curves.easeInOut",
|
|
18
|
+
fastOutSlowIn = "Curves.fastOutSlowIn",
|
|
19
|
+
linear = "Curves.linear"
|
|
20
|
+
}
|
|
21
|
+
interface CarouselSliderProps {
|
|
22
|
+
/**
|
|
23
|
+
* 当前页面索引(0-based)
|
|
24
|
+
*
|
|
25
|
+
* - 设置此值会触发页面跳转
|
|
26
|
+
* - 页面变化时会自动更新此值
|
|
27
|
+
* - 读取此值可获取当前页索引
|
|
28
|
+
*
|
|
29
|
+
* @default 0
|
|
30
|
+
* @attribute current-index
|
|
31
|
+
*/
|
|
32
|
+
currentIndex?: number;
|
|
33
|
+
/**
|
|
34
|
+
* JSON 格式的批量配置
|
|
35
|
+
*
|
|
36
|
+
* 一次设置多个属性,使用 JSON 格式
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* carousel.options = JSON.stringify({
|
|
40
|
+
* autoplay: true,
|
|
41
|
+
* autoplayInterval: 4.0,
|
|
42
|
+
* viewportFraction: 0.8,
|
|
43
|
+
* enlargeCenterPage: true,
|
|
44
|
+
* enlargeFactor: 0.3
|
|
45
|
+
* });
|
|
46
|
+
*
|
|
47
|
+
* @attribute options
|
|
48
|
+
*/
|
|
49
|
+
options?: string;
|
|
50
|
+
/**
|
|
51
|
+
* 轮播高度(字符串形式)
|
|
52
|
+
*
|
|
53
|
+
* - 如果设置了 height,将覆盖 aspectRatio
|
|
54
|
+
* - 支持 "400", "400px", "400.0" 等格式
|
|
55
|
+
* - 单位为逻辑像素
|
|
56
|
+
*
|
|
57
|
+
* @default null
|
|
58
|
+
* @attribute height
|
|
59
|
+
*/
|
|
60
|
+
height?: string;
|
|
61
|
+
/**
|
|
62
|
+
* 宽高比
|
|
63
|
+
*
|
|
64
|
+
* - 如果未设置 height,则根据此比例计算高度
|
|
65
|
+
* - 常见比例: 16/9, 4/3, 1/1
|
|
66
|
+
*
|
|
67
|
+
* @default 16/9
|
|
68
|
+
* @attribute aspect-ratio
|
|
69
|
+
*/
|
|
70
|
+
aspectRatio?: number;
|
|
71
|
+
/**
|
|
72
|
+
* 视口占比
|
|
73
|
+
*
|
|
74
|
+
* - 每个页面占据视口的宽度比例
|
|
75
|
+
* - 范围: 0.0 - 1.0
|
|
76
|
+
* - 小于 1.0 时可看到相邻页面的一部分
|
|
77
|
+
*
|
|
78
|
+
* @default 0.8
|
|
79
|
+
* @attribute viewport-fraction
|
|
80
|
+
*/
|
|
81
|
+
viewportFraction?: number;
|
|
82
|
+
/**
|
|
83
|
+
* 初始页面索引
|
|
84
|
+
*
|
|
85
|
+
* - 组件首次加载时显示的页面
|
|
86
|
+
* - 仅在初始化时生效
|
|
87
|
+
*
|
|
88
|
+
* @default 0
|
|
89
|
+
* @attribute initial-page
|
|
90
|
+
*/
|
|
91
|
+
initialPage?: number;
|
|
92
|
+
/**
|
|
93
|
+
* 两端添加填充
|
|
94
|
+
*
|
|
95
|
+
* - viewportFraction < 1.0 时生效
|
|
96
|
+
* - 为首尾页面添加填充,使其可以居中显示
|
|
97
|
+
*
|
|
98
|
+
* @default true
|
|
99
|
+
* @attribute pad-ends
|
|
100
|
+
*/
|
|
101
|
+
padEnds: boolean;
|
|
102
|
+
/**
|
|
103
|
+
* 禁用 Center widget
|
|
104
|
+
*
|
|
105
|
+
* - 为每个页面禁用 Center widget
|
|
106
|
+
* - 可能会影响布局对齐
|
|
107
|
+
*
|
|
108
|
+
* @default false
|
|
109
|
+
* @experimental 暂未实现,将在未来版本中添加
|
|
110
|
+
* @attribute disable-center
|
|
111
|
+
*/
|
|
112
|
+
disableCenter?: boolean;
|
|
113
|
+
/**
|
|
114
|
+
* 启用无限循环滚动
|
|
115
|
+
*
|
|
116
|
+
* - true: 可以无限向前/向后滚动
|
|
117
|
+
* - false: 到达首尾时停止
|
|
118
|
+
*
|
|
119
|
+
* @default true
|
|
120
|
+
* @attribute enable-infinite-scroll
|
|
121
|
+
*/
|
|
122
|
+
enableInfiniteScroll: boolean;
|
|
123
|
+
/**
|
|
124
|
+
* 循环到最近的页面
|
|
125
|
+
*
|
|
126
|
+
* - enableInfiniteScroll = true 时生效
|
|
127
|
+
* - 跳转时选择最近的循环路径
|
|
128
|
+
* - 减少跳转动画的距离
|
|
129
|
+
*
|
|
130
|
+
* @default true
|
|
131
|
+
* @experimental 暂未实现,将在未来版本中添加
|
|
132
|
+
* @attribute animate-to-closest
|
|
133
|
+
*/
|
|
134
|
+
animateToClosest?: boolean;
|
|
135
|
+
/**
|
|
136
|
+
* 反向滚动
|
|
137
|
+
*
|
|
138
|
+
* - 翻转轮播的滚动方向
|
|
139
|
+
* - 水平模式下从右到左
|
|
140
|
+
* - 垂直模式下从下到上
|
|
141
|
+
*
|
|
142
|
+
* @default false
|
|
143
|
+
* @attribute reverse
|
|
144
|
+
*/
|
|
145
|
+
reverse: boolean;
|
|
146
|
+
/**
|
|
147
|
+
* 滚动方向
|
|
148
|
+
*
|
|
149
|
+
* - Axis.horizontal: 水平滚动(默认)
|
|
150
|
+
* - Axis.vertical: 垂直滚动
|
|
151
|
+
*
|
|
152
|
+
* @default 'Axis.horizontal'
|
|
153
|
+
* @attribute scroll-direction
|
|
154
|
+
*/
|
|
155
|
+
scrollDirection?: Axis$1;
|
|
156
|
+
/**
|
|
157
|
+
* 页面吸附效果
|
|
158
|
+
*
|
|
159
|
+
* - true: 滚动停止时自动吸附到页面边界
|
|
160
|
+
* - false: 可以停留在任意位置
|
|
161
|
+
*
|
|
162
|
+
* @default true
|
|
163
|
+
* @attribute page-snapping
|
|
164
|
+
*/
|
|
165
|
+
pageSnapping: boolean;
|
|
166
|
+
/**
|
|
167
|
+
* 滚动物理效果
|
|
168
|
+
*
|
|
169
|
+
* - 高级配置,控制滚动行为
|
|
170
|
+
* - 通常不需要手动设置
|
|
171
|
+
*
|
|
172
|
+
* @experimental 暂未实现,未来版本可能添加
|
|
173
|
+
* @attribute scroll-physics
|
|
174
|
+
*/
|
|
175
|
+
scrollPhysics?: string;
|
|
176
|
+
/**
|
|
177
|
+
* 启用自动播放
|
|
178
|
+
*
|
|
179
|
+
* - 开启后会按间隔自动切换页面
|
|
180
|
+
* - 可通过 pause() 方法或用户交互暂停
|
|
181
|
+
* - 可通过 resume() 方法恢复
|
|
182
|
+
*
|
|
183
|
+
* @default false
|
|
184
|
+
* @attribute autoplay
|
|
185
|
+
*/
|
|
186
|
+
autoplay: boolean;
|
|
187
|
+
/**
|
|
188
|
+
* 自动播放间隔(秒)
|
|
189
|
+
*
|
|
190
|
+
* - 两次自动播放之间的时间间隔
|
|
191
|
+
* - 单位为秒(不是毫秒)
|
|
192
|
+
* - 建议最小值: 0.5 秒
|
|
193
|
+
*
|
|
194
|
+
* @default 4.0
|
|
195
|
+
* @attribute autoplay-interval
|
|
196
|
+
*/
|
|
197
|
+
autoplayInterval?: number;
|
|
198
|
+
/**
|
|
199
|
+
* 自动播放动画持续时间(毫秒)
|
|
200
|
+
*
|
|
201
|
+
* - 页面切换动画的持续时间
|
|
202
|
+
* - 单位为毫秒
|
|
203
|
+
* - 建议范围: 100 - 5000
|
|
204
|
+
*
|
|
205
|
+
* @default 800
|
|
206
|
+
* @attribute auto-play-animation-duration
|
|
207
|
+
*/
|
|
208
|
+
autoPlayAnimationDuration?: number;
|
|
209
|
+
/**
|
|
210
|
+
* 自动播放动画曲线
|
|
211
|
+
*
|
|
212
|
+
* - 控制动画的时间-速度曲线
|
|
213
|
+
* - 常用值: Curves.fastOutSlowIn(默认)、Curves.ease
|
|
214
|
+
*
|
|
215
|
+
* @default 'Curves.fastOutSlowIn'
|
|
216
|
+
* @attribute auto-play-curve
|
|
217
|
+
*/
|
|
218
|
+
autoPlayCurve?: Curve$1;
|
|
219
|
+
/**
|
|
220
|
+
* 触摸时暂停自动播放
|
|
221
|
+
*
|
|
222
|
+
* - 用户触摸轮播时自动暂停
|
|
223
|
+
* - 松手后自动恢复播放
|
|
224
|
+
* - 提供更好的交互体验
|
|
225
|
+
*
|
|
226
|
+
* @default true
|
|
227
|
+
* @attribute pause-auto-play-on-touch
|
|
228
|
+
*/
|
|
229
|
+
pauseAutoPlayOnTouch: boolean;
|
|
230
|
+
/**
|
|
231
|
+
* 手动导航时暂停自动播放
|
|
232
|
+
*
|
|
233
|
+
* - 调用 next()/previous()/jumpToPage() 时暂停
|
|
234
|
+
* - 动画完成后自动恢复播放
|
|
235
|
+
* - 防止自动播放干扰用户操作
|
|
236
|
+
*
|
|
237
|
+
* @default true
|
|
238
|
+
* @attribute pause-auto-play-on-manual-navigate
|
|
239
|
+
*/
|
|
240
|
+
pauseAutoPlayOnManualNavigate: boolean;
|
|
241
|
+
/**
|
|
242
|
+
* 非无限循环时到达末尾暂停自动播放
|
|
243
|
+
*
|
|
244
|
+
* - enableInfiniteScroll = false 时生效
|
|
245
|
+
* - 到达最后一页时是否暂停自动播放
|
|
246
|
+
* - false 则会循环到第一页
|
|
247
|
+
*
|
|
248
|
+
* @default false
|
|
249
|
+
* @experimental 暂未实现,将在未来版本中添加
|
|
250
|
+
* @attribute pause-auto-play-in-finite-scroll
|
|
251
|
+
*/
|
|
252
|
+
pauseAutoPlayInFiniteScroll?: boolean;
|
|
253
|
+
/**
|
|
254
|
+
* 放大中心页
|
|
255
|
+
*
|
|
256
|
+
* - 当前页面显示得比相邻页面大
|
|
257
|
+
* - 创造出一种深度感
|
|
258
|
+
* - 需要 enlargeFactor 配合使用
|
|
259
|
+
*
|
|
260
|
+
* @default false
|
|
261
|
+
* @attribute enlarge-center-page
|
|
262
|
+
*/
|
|
263
|
+
enlargeCenterPage: boolean;
|
|
264
|
+
/**
|
|
265
|
+
* 中心页放大策略
|
|
266
|
+
*
|
|
267
|
+
* - scale: 通过缩放放大(默认)
|
|
268
|
+
* - height: 通过高度放大
|
|
269
|
+
* - zoom: 通过缩放放大(与 scale 类似但有细微差别)
|
|
270
|
+
*
|
|
271
|
+
* @default 'scale'
|
|
272
|
+
* @experimental 暂未实现,将在未来版本中添加
|
|
273
|
+
* @attribute enlarge-strategy
|
|
274
|
+
*/
|
|
275
|
+
enlargeStrategy?: CenterPageEnlargeStrategy$1;
|
|
276
|
+
/**
|
|
277
|
+
* 中心页放大因子
|
|
278
|
+
*
|
|
279
|
+
* - 相邻页面相对于中心页的缩小比例
|
|
280
|
+
* - 范围: 0.0 - 1.0
|
|
281
|
+
* - 值越大,相邻页缩小越多
|
|
282
|
+
*
|
|
283
|
+
* @default 0.3
|
|
284
|
+
* @attribute enlarge-factor
|
|
285
|
+
*/
|
|
286
|
+
enlargeFactor?: number;
|
|
287
|
+
/**
|
|
288
|
+
* 页面变化事件
|
|
289
|
+
*
|
|
290
|
+
* 当轮播切换到新页面时触发
|
|
291
|
+
*
|
|
292
|
+
* @event change
|
|
293
|
+
* @property {number} detail.index - 新页面索引(0-based)
|
|
294
|
+
* @property {CarouselPageChangedReason} detail.reason - 触发原因
|
|
295
|
+
*
|
|
296
|
+
* @example
|
|
297
|
+
* carousel.addEventListener('change', (event) => {
|
|
298
|
+
* console.log('New page:', event.detail.index);
|
|
299
|
+
* console.log('Reason:', event.detail.reason);
|
|
300
|
+
* // Reason: 'timed' | 'manual' | 'controller'
|
|
301
|
+
* });
|
|
302
|
+
*/
|
|
303
|
+
onChange?: (event: CustomEvent<any>) => void;
|
|
304
|
+
/**
|
|
305
|
+
* 滑动开始事件
|
|
306
|
+
*
|
|
307
|
+
* 用户开始拖动轮播时触发
|
|
308
|
+
*
|
|
309
|
+
* @event slidestart
|
|
310
|
+
*
|
|
311
|
+
* @example
|
|
312
|
+
* carousel.addEventListener('slidestart', () => {
|
|
313
|
+
* console.log('User started sliding');
|
|
314
|
+
* });
|
|
315
|
+
*/
|
|
316
|
+
onSlidestart?: (event: Event) => void;
|
|
317
|
+
/**
|
|
318
|
+
* 滑动结束事件
|
|
319
|
+
*
|
|
320
|
+
* 用户停止拖动轮播时触发
|
|
321
|
+
*
|
|
322
|
+
* @event slideend
|
|
323
|
+
*
|
|
324
|
+
* @example
|
|
325
|
+
* carousel.addEventListener('slideend', () => {
|
|
326
|
+
* console.log('User stopped sliding');
|
|
327
|
+
* });
|
|
328
|
+
*/
|
|
329
|
+
onSlideend?: (event: Event) => void;
|
|
330
|
+
/**
|
|
331
|
+
* 页面动画开始事件
|
|
332
|
+
*
|
|
333
|
+
* 页面切换动画开始时触发
|
|
334
|
+
*
|
|
335
|
+
* @event pageanimationstart
|
|
336
|
+
* @property {number} detail.from - 起始页面索引
|
|
337
|
+
* @property {number} detail.to - 目标页面索引
|
|
338
|
+
*
|
|
339
|
+
* @example
|
|
340
|
+
* carousel.addEventListener('pageanimationstart', (event) => {
|
|
341
|
+
* console.log(`Animating from ${event.detail.from} to ${event.detail.to}`);
|
|
342
|
+
* });
|
|
343
|
+
*/
|
|
344
|
+
onPageanimationstart?: (event: CustomEvent<any>) => void;
|
|
345
|
+
/**
|
|
346
|
+
* 页面动画结束事件
|
|
347
|
+
*
|
|
348
|
+
* 页面切换动画完成时触发
|
|
349
|
+
*
|
|
350
|
+
* @event pageanimationend
|
|
351
|
+
* @property {number} detail.index - 当前页面索引
|
|
352
|
+
*
|
|
353
|
+
* @example
|
|
354
|
+
* carousel.addEventListener('pageanimationend', (event) => {
|
|
355
|
+
* console.log(`Animation ended at page ${event.detail.index}`);
|
|
356
|
+
* });
|
|
357
|
+
*/
|
|
358
|
+
onPageanimationend?: (event: CustomEvent<any>) => void;
|
|
359
|
+
/**
|
|
360
|
+
* 自动播放暂停事件
|
|
361
|
+
*
|
|
362
|
+
* 自动播放被暂停时触发
|
|
363
|
+
*
|
|
364
|
+
* @event autoplaypause
|
|
365
|
+
*
|
|
366
|
+
* @example
|
|
367
|
+
* carousel.addEventListener('autoplaypause', () => {
|
|
368
|
+
* console.log('Autoplay paused');
|
|
369
|
+
* });
|
|
370
|
+
*/
|
|
371
|
+
onAutoplaypause?: (event: Event) => void;
|
|
372
|
+
/**
|
|
373
|
+
* 自动播放恢复事件
|
|
374
|
+
*
|
|
375
|
+
* 自动播放恢复时触发
|
|
376
|
+
*
|
|
377
|
+
* @event autoplayresume
|
|
378
|
+
*
|
|
379
|
+
* @example
|
|
380
|
+
* carousel.addEventListener('autoplayresume', () => {
|
|
381
|
+
* console.log('Autoplay resumed');
|
|
382
|
+
* });
|
|
383
|
+
*/
|
|
384
|
+
onAutoplayresume?: (event: Event) => void;
|
|
385
|
+
/**
|
|
386
|
+
* 滚动事件
|
|
387
|
+
*
|
|
388
|
+
* 轮播滚动时持续触发
|
|
389
|
+
*
|
|
390
|
+
* @event scrolled
|
|
391
|
+
* @property {number | null} detail - 当前滚动位置(像素),null 表示无法确定
|
|
392
|
+
*
|
|
393
|
+
* @example
|
|
394
|
+
* carousel.addEventListener('scrolled', (event) => {
|
|
395
|
+
* console.log('Scrolled to:', event.detail);
|
|
396
|
+
* });
|
|
397
|
+
*
|
|
398
|
+
* @experimental 暂未实现,将在未来版本中添加
|
|
399
|
+
*/
|
|
400
|
+
onScrolled?: (event: CustomEvent<number | null>) => void;
|
|
401
|
+
/**
|
|
402
|
+
* 单项点击事件
|
|
403
|
+
*
|
|
404
|
+
* 点击轮播图片项时触发
|
|
405
|
+
*
|
|
406
|
+
* @event itemclick
|
|
407
|
+
* @property {string | number} detail.id - 图片项 ID
|
|
408
|
+
*
|
|
409
|
+
* @example
|
|
410
|
+
* carousel.addEventListener('itemclick', (event) => {
|
|
411
|
+
* console.log('Clicked item id:', event.detail.id);
|
|
412
|
+
* });
|
|
413
|
+
*/
|
|
414
|
+
onItemclick?: (event: CustomEvent<any>) => void;
|
|
415
|
+
/**
|
|
416
|
+
* HTML id attribute
|
|
417
|
+
*/
|
|
418
|
+
id?: string;
|
|
419
|
+
/**
|
|
420
|
+
* Additional CSS styles
|
|
421
|
+
*/
|
|
422
|
+
style?: React.CSSProperties;
|
|
423
|
+
/**
|
|
424
|
+
* Children elements
|
|
425
|
+
*/
|
|
426
|
+
children?: React.ReactNode;
|
|
427
|
+
/**
|
|
428
|
+
* Additional CSS class names
|
|
429
|
+
*/
|
|
430
|
+
className?: string;
|
|
431
|
+
}
|
|
432
|
+
/**
|
|
433
|
+
* Element interface with methods accessible via ref
|
|
434
|
+
* @example
|
|
435
|
+
* ```tsx
|
|
436
|
+
* const ref = useRef<CarouselSliderElement>(null);
|
|
437
|
+
* // Call methods on the element
|
|
438
|
+
* ref.current?.finishRefresh('success');
|
|
439
|
+
* ```
|
|
440
|
+
*/
|
|
441
|
+
interface CarouselSliderElement extends WebFElementWithMethods<{
|
|
442
|
+
/**
|
|
443
|
+
* 下一页(带动画)
|
|
444
|
+
*
|
|
445
|
+
* 切换到下一页,使用动画
|
|
446
|
+
*
|
|
447
|
+
* @param duration - 动画持续时间(毫秒),默认 300ms
|
|
448
|
+
* @param curve - 动画曲线,默认 'Curves.linear'
|
|
449
|
+
*
|
|
450
|
+
* @throws 如果已到达最后一页且 enableInfiniteScroll = false
|
|
451
|
+
*
|
|
452
|
+
* @example
|
|
453
|
+
* carousel.next();
|
|
454
|
+
*
|
|
455
|
+
* @example
|
|
456
|
+
* // 自定义动画
|
|
457
|
+
* carousel.next(500, 'Curves.easeInOut');
|
|
458
|
+
*/
|
|
459
|
+
next(duration: number, curve: Curve$1): void;
|
|
460
|
+
/**
|
|
461
|
+
* 上一页(带动画)
|
|
462
|
+
*
|
|
463
|
+
* 切换到上一页,使用动画
|
|
464
|
+
*
|
|
465
|
+
* @param duration - 动画持续时间(毫秒),默认 300ms
|
|
466
|
+
* @param curve - 动画曲线,默认 'Curves.linear'
|
|
467
|
+
*
|
|
468
|
+
* @throws 如果已在第一页且 enableInfiniteScroll = false
|
|
469
|
+
*
|
|
470
|
+
* @example
|
|
471
|
+
* carousel.previous();
|
|
472
|
+
*/
|
|
473
|
+
previous(duration: number, curve: Curve$1): void;
|
|
474
|
+
/**
|
|
475
|
+
* 跳转到指定页(无动画)
|
|
476
|
+
*
|
|
477
|
+
* 立即跳转到目标页面,不显示动画
|
|
478
|
+
*
|
|
479
|
+
* @param page - 目标页面索引(0-based)
|
|
480
|
+
* @throws 如果 page < 0 或 page >= 页面总数
|
|
481
|
+
*
|
|
482
|
+
* @example
|
|
483
|
+
* carousel.jumpToPage(0); // 跳转到第一页
|
|
484
|
+
* carousel.jumpToPage(2); // 跳转到第三页
|
|
485
|
+
*/
|
|
486
|
+
jumpToPage(page: number): void;
|
|
487
|
+
/**
|
|
488
|
+
* 动画到指定页(带动画)
|
|
489
|
+
*
|
|
490
|
+
* 带动画切换到目标页面
|
|
491
|
+
*
|
|
492
|
+
* @param page - 目标页面索引(0-based)
|
|
493
|
+
* @param duration - 动画持续时间(毫秒),默认 300ms
|
|
494
|
+
* @param curve - 动画曲线,默认 'Curves.linear'
|
|
495
|
+
* @throws 如果 page < 0 或 page >= 页面总数
|
|
496
|
+
*
|
|
497
|
+
* @example
|
|
498
|
+
* // 使用默认动画
|
|
499
|
+
* carousel.animateToPage(2);
|
|
500
|
+
*
|
|
501
|
+
* @example
|
|
502
|
+
* // 自定义动画
|
|
503
|
+
* carousel.animateToPage(2, 500, 'Curves.easeInOut');
|
|
504
|
+
*
|
|
505
|
+
* @experimental 暂未实现,将在未来版本中添加
|
|
506
|
+
*/
|
|
507
|
+
animateToPage(page: number, duration: number, curve: Curve$1): void;
|
|
508
|
+
/**
|
|
509
|
+
* 暂停自动播放
|
|
510
|
+
*
|
|
511
|
+
* 立即暂停自动播放
|
|
512
|
+
* - 触发 autoplaypause 事件
|
|
513
|
+
* - 不会修改 autoplay 属性
|
|
514
|
+
*
|
|
515
|
+
* @example
|
|
516
|
+
* carousel.pause();
|
|
517
|
+
*
|
|
518
|
+
* @see resume
|
|
519
|
+
* @see stopAutoPlay
|
|
520
|
+
*/
|
|
521
|
+
pause(): void;
|
|
522
|
+
/**
|
|
523
|
+
* 恢复自动播放
|
|
524
|
+
*
|
|
525
|
+
* 恢复之前暂停的自动播放
|
|
526
|
+
* - 触发 autoplayresume 事件
|
|
527
|
+
* - 如果 autoplay = false,此方法无效
|
|
528
|
+
*
|
|
529
|
+
* @example
|
|
530
|
+
* carousel.resume();
|
|
531
|
+
*
|
|
532
|
+
* @see pause
|
|
533
|
+
* @see startAutoPlay
|
|
534
|
+
*/
|
|
535
|
+
resume(): void;
|
|
536
|
+
/**
|
|
537
|
+
* 启动自动播放
|
|
538
|
+
*
|
|
539
|
+
* 强制启动自动播放计时器
|
|
540
|
+
* - 比 resume() 更明确
|
|
541
|
+
* - 即使 autoplay = false 也能启动
|
|
542
|
+
*
|
|
543
|
+
* @example
|
|
544
|
+
* carousel.startAutoPlay();
|
|
545
|
+
*
|
|
546
|
+
* @see resume
|
|
547
|
+
* @see stopAutoPlay
|
|
548
|
+
*
|
|
549
|
+
* @experimental 暂未实现,将在未来版本中添加
|
|
550
|
+
*/
|
|
551
|
+
startAutoPlay(): void;
|
|
552
|
+
/**
|
|
553
|
+
* 停止自动播放
|
|
554
|
+
*
|
|
555
|
+
* 强制停止自动播放计时器
|
|
556
|
+
* - 比 pause() 更明确
|
|
557
|
+
* - 会暂停直到调用 startAutoPlay() 或 resume()
|
|
558
|
+
*
|
|
559
|
+
* @example
|
|
560
|
+
* carousel.stopAutoPlay();
|
|
561
|
+
*
|
|
562
|
+
* @see pause
|
|
563
|
+
* @see startAutoPlay
|
|
564
|
+
*
|
|
565
|
+
* @experimental 暂未实现,将在未来版本中添加
|
|
566
|
+
*/
|
|
567
|
+
stopAutoPlay(): void;
|
|
568
|
+
}> {
|
|
569
|
+
}
|
|
570
|
+
/**
|
|
571
|
+
* Properties for <carousel-slider> Custom Element
|
|
572
|
+
所有属性都支持 HTML 属性方式设置(kebab-case)
|
|
573
|
+
和 JavaScript 属性方式设置(camelCase)
|
|
574
|
+
@example
|
|
575
|
+
// HTML 方式
|
|
576
|
+
<carousel-slider autoplay="true" autoplay-interval="4"></carousel-slider>
|
|
577
|
+
@example
|
|
578
|
+
// JavaScript 方式
|
|
579
|
+
carousel.autoplay = true;
|
|
580
|
+
carousel.autoplayInterval = 4;
|
|
581
|
+
*
|
|
582
|
+
* @example
|
|
583
|
+
* ```tsx
|
|
584
|
+
* const ref = useRef<CarouselSliderElement>(null);
|
|
585
|
+
*
|
|
586
|
+
* <CarouselSlider
|
|
587
|
+
* ref={ref}
|
|
588
|
+
* // Add props here
|
|
589
|
+
* >
|
|
590
|
+
* Content
|
|
591
|
+
* </CarouselSlider>
|
|
592
|
+
*
|
|
593
|
+
* // Call methods on the element
|
|
594
|
+
* ref.current?.finishRefresh('success');
|
|
595
|
+
* ```
|
|
596
|
+
*/
|
|
597
|
+
declare const CarouselSlider: React.ForwardRefExoticComponent<CarouselSliderProps & {
|
|
598
|
+
className?: string;
|
|
599
|
+
style?: React.CSSProperties;
|
|
600
|
+
children?: React.ReactNode;
|
|
601
|
+
} & React.RefAttributes<CarouselSliderElement>>;
|
|
602
|
+
|
|
603
|
+
declare enum CarouselPageChangedReason {
|
|
604
|
+
timed = "timed",
|
|
605
|
+
manual = "manual",
|
|
606
|
+
controller = "controller"
|
|
607
|
+
}
|
|
608
|
+
declare enum CenterPageEnlargeStrategy {
|
|
609
|
+
scale = "scale",
|
|
610
|
+
height = "height",
|
|
611
|
+
zoom = "zoom"
|
|
612
|
+
}
|
|
613
|
+
declare enum Axis {
|
|
614
|
+
horizontal = "Axis.horizontal",
|
|
615
|
+
vertical = "Axis.vertical"
|
|
616
|
+
}
|
|
617
|
+
declare enum Curve {
|
|
618
|
+
ease = "Curves.ease",
|
|
619
|
+
easeIn = "Curves.easeIn",
|
|
620
|
+
easeOut = "Curves.easeOut",
|
|
621
|
+
easeInOut = "Curves.easeInOut",
|
|
622
|
+
fastOutSlowIn = "Curves.fastOutSlowIn",
|
|
623
|
+
linear = "Curves.linear"
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
export { Axis, CarouselPageChangedReason, CarouselSlider, type CarouselSliderElement, CenterPageEnlargeStrategy, Curve };
|