Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

faeat(Carousel): 增加走马灯组件Carousel #691

Merged
merged 672 commits into from Mar 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
672 commits
Select commit Hold shift + click to select a range
af77182
chore: update workflows config.
jaywcjlove Feb 25, 2022
986d03f
chore: update workflows config.
jaywcjlove Feb 25, 2022
e7366de
chore: update workflows config.
jaywcjlove Feb 25, 2022
84a9f9c
chore: update workflows config.
jaywcjlove Feb 25, 2022
3072fa8
chore: update workflows config.
jaywcjlove Feb 25, 2022
d728f6a
chore: update workflows config.
jaywcjlove Feb 25, 2022
d000ebb
chore: update workflows config.
jaywcjlove Feb 25, 2022
9ce396d
chore: update workflows config.
jaywcjlove Feb 25, 2022
11d2314
chore: update workflows config.
jaywcjlove Feb 25, 2022
787907d
chore: update workflows config.
jaywcjlove Feb 25, 2022
20d7cd7
chore: update workflows config.
jaywcjlove Feb 25, 2022
510c9f6
chore: update workflows config.
jaywcjlove Feb 25, 2022
4388609
chore: update workflows config.
jaywcjlove Feb 25, 2022
185d2d3
chore: update workflows config.
jaywcjlove Feb 25, 2022
ffcfacb
chore: update workflows config.
jaywcjlove Feb 25, 2022
1a4dd9a
chore: update workflows config.
jaywcjlove Feb 25, 2022
0912113
chore: update workflows config.
jaywcjlove Feb 25, 2022
de043c0
chore: update workflows config.
jaywcjlove Feb 25, 2022
32639e4
chore: update workflows config.
jaywcjlove Feb 25, 2022
f525988
chore: update workflows config.
jaywcjlove Feb 25, 2022
7602f12
chore: update workflows config.
jaywcjlove Feb 25, 2022
d0ecfb2
chore: update workflows config.
jaywcjlove Feb 25, 2022
bd5c8f6
chore: update workflows config.
jaywcjlove Feb 25, 2022
8882666
chore: update workflows config.
jaywcjlove Feb 25, 2022
0cd679c
chore: update workflows config.
jaywcjlove Feb 25, 2022
c9f846f
chore: update workflows config.
jaywcjlove Feb 25, 2022
2ffb7c5
chore: update workflows config.
jaywcjlove Feb 25, 2022
3a7f958
chore: update workflows config.
jaywcjlove Feb 25, 2022
b936455
chore: update workflows config.
jaywcjlove Feb 25, 2022
60434b7
chore: update workflows config.
jaywcjlove Feb 25, 2022
388324b
chore: update workflows config.
jaywcjlove Feb 25, 2022
b0c3726
chore: update workflows config.
jaywcjlove Feb 25, 2022
b710f38
chore: update workflows config.
jaywcjlove Feb 25, 2022
ebfcf5b
chore: update workflows config.
jaywcjlove Feb 25, 2022
1837b3f
chore: update workflows config.
jaywcjlove Feb 25, 2022
5bf66ed
chore: update workflows config.
jaywcjlove Feb 25, 2022
4119d30
chore: update workflows config.
jaywcjlove Feb 25, 2022
b917736
chore: update workflows config.
jaywcjlove Feb 25, 2022
79fc797
chore: update workflows config.
jaywcjlove Feb 25, 2022
b275766
chore: update workflows config.
jaywcjlove Feb 25, 2022
00f9443
chore: update workflows config.
jaywcjlove Feb 25, 2022
2b081f6
chore: update workflows config.
jaywcjlove Feb 25, 2022
b65d597
chore: update workflows config.
jaywcjlove Feb 25, 2022
3d2c38f
chore: update workflows config.
jaywcjlove Feb 25, 2022
1a3dad0
chore: update workflows config.
jaywcjlove Feb 25, 2022
51827fa
chore: update workflows config.
jaywcjlove Feb 25, 2022
526df26
chore: update workflows config.
jaywcjlove Feb 25, 2022
8ae9074
chore: update workflows config.
jaywcjlove Feb 25, 2022
448181e
chore: update workflows config.
jaywcjlove Feb 25, 2022
83144a8
chore: update workflows config.
jaywcjlove Feb 25, 2022
42022a1
chore: update workflows config.
jaywcjlove Feb 25, 2022
5c742b0
chore: update workflows config.
jaywcjlove Feb 25, 2022
e03e7fa
chore: update workflows config.
jaywcjlove Feb 25, 2022
ef264fc
chore: update workflows config.
jaywcjlove Feb 25, 2022
6ff5338
chore: update workflows config.
jaywcjlove Feb 25, 2022
c63a027
chore: update workflows config.
jaywcjlove Feb 25, 2022
c2193f6
chore: update workflows config.
jaywcjlove Feb 25, 2022
c0c77fe
chore: update workflows config.
jaywcjlove Feb 25, 2022
ffa2e85
chore: update workflows config.
jaywcjlove Feb 25, 2022
79087a3
chore: update workflows config.
jaywcjlove Feb 25, 2022
48ee2bd
chore: update workflows config.
jaywcjlove Feb 25, 2022
c61cb2c
chore: update workflows config.
jaywcjlove Feb 25, 2022
de00013
chore: update workflows config.
jaywcjlove Feb 25, 2022
e74dd79
chore: update workflows config.
jaywcjlove Feb 25, 2022
864ab0b
chore: update workflows config.
jaywcjlove Feb 25, 2022
b00bdab
chore: update workflows config.
jaywcjlove Feb 25, 2022
c9fac2c
chore: update workflows config.
jaywcjlove Feb 25, 2022
393d666
chore: update workflows config.
jaywcjlove Feb 25, 2022
0017aa8
chore: update workflows config.
jaywcjlove Feb 25, 2022
ca1a3e9
chore: update workflows config.
jaywcjlove Feb 25, 2022
dd90725
chore: update workflows config.
jaywcjlove Feb 25, 2022
b3633b0
chore: update workflows config.
jaywcjlove Feb 25, 2022
078f163
chore: update workflows config.
jaywcjlove Feb 25, 2022
6df14ea
chore: update workflows config.
jaywcjlove Feb 25, 2022
0dacb63
chore: update workflows config.
jaywcjlove Feb 25, 2022
9c19ecd
chore: update workflows config.
jaywcjlove Feb 25, 2022
16fc885
chore: update workflows config.
jaywcjlove Feb 25, 2022
f3e9efb
chore: update workflows config.
jaywcjlove Feb 25, 2022
2a02bc4
chore: update workflows config.
jaywcjlove Feb 25, 2022
d746c34
chore: update workflows config.
jaywcjlove Feb 25, 2022
d5d7bf3
chore: update workflows config.
jaywcjlove Feb 25, 2022
106334b
chore: update workflows config.
jaywcjlove Feb 25, 2022
b3b0d5a
chore: update workflows config.
jaywcjlove Feb 25, 2022
5ba8840
chore: update workflows config.
jaywcjlove Feb 25, 2022
73585a2
chore: update workflows config.
jaywcjlove Feb 25, 2022
eeb9c39
chore: update workflows config.
jaywcjlove Feb 25, 2022
16e733b
chore: update workflows config.
jaywcjlove Feb 25, 2022
d8d334c
chore: update workflows config.
jaywcjlove Feb 25, 2022
c618dba
chore: update workflows config.
jaywcjlove Feb 25, 2022
8c2fdae
chore: update workflows config.
jaywcjlove Feb 25, 2022
1372782
chore: update workflows config.
jaywcjlove Feb 25, 2022
52f790b
chore: update workflows config.
jaywcjlove Feb 25, 2022
829fe5c
chore: update workflows config.
jaywcjlove Feb 25, 2022
9febbff
chore: update workflows config.
jaywcjlove Feb 25, 2022
9794158
chore: update workflows config.
jaywcjlove Feb 25, 2022
6527dc0
chore: update workflows config.
jaywcjlove Feb 25, 2022
5717afe
chore: update workflows config.
jaywcjlove Feb 25, 2022
472113e
chore: update workflows config.
jaywcjlove Feb 25, 2022
7b018d6
chore: update workflows config.
jaywcjlove Feb 25, 2022
afdde71
chore: update workflows config.
jaywcjlove Feb 25, 2022
786359c
chore: update workflows config.
jaywcjlove Feb 25, 2022
0138376
chore: update workflows config.
jaywcjlove Feb 25, 2022
3234426
chore: update workflows config.
jaywcjlove Feb 25, 2022
73d6657
chore: update workflows config.
jaywcjlove Feb 25, 2022
94c52eb
chore: update workflows config.
jaywcjlove Feb 25, 2022
80491a2
chore: update workflows config.
jaywcjlove Feb 25, 2022
730b78b
chore: update workflows config.
jaywcjlove Feb 25, 2022
a88bbe5
chore: update workflows config.
jaywcjlove Feb 25, 2022
e08fbb1
chore: update workflows config.
jaywcjlove Feb 25, 2022
bd24886
chore: update workflows config.
jaywcjlove Feb 25, 2022
8a9e362
chore: update workflows config.
jaywcjlove Feb 25, 2022
994e832
chore: update workflows config.
jaywcjlove Feb 25, 2022
d24b155
chore: update workflows config.
jaywcjlove Feb 25, 2022
5ee5014
chore: update workflows config.
jaywcjlove Feb 25, 2022
00dd89b
chore: update workflows config.
jaywcjlove Feb 25, 2022
df83735
chore: update workflows config.
jaywcjlove Feb 25, 2022
a87cc46
chore: update workflows config.
jaywcjlove Feb 25, 2022
80db60e
chore: update workflows config.
jaywcjlove Feb 25, 2022
d4f12e2
chore: update workflows config.
jaywcjlove Feb 25, 2022
eec83cb
chore: update workflows config.
jaywcjlove Feb 25, 2022
05d95bd
chore: update workflows config.
jaywcjlove Feb 25, 2022
4bb2f80
chore: update workflows config.
jaywcjlove Feb 25, 2022
794742a
chore: update workflows config.
jaywcjlove Feb 25, 2022
6b2bdbb
chore: update workflows config.
jaywcjlove Feb 25, 2022
429cbc2
chore: update workflows config.
jaywcjlove Feb 25, 2022
2de0a60
chore: update workflows config.
jaywcjlove Feb 25, 2022
5646547
chore: update workflows config.
jaywcjlove Feb 25, 2022
0c31d44
chore: update workflows config.
jaywcjlove Feb 25, 2022
8f0d57a
chore: update workflows config.
jaywcjlove Feb 25, 2022
be4a1ef
chore: update workflows config.
jaywcjlove Feb 25, 2022
b0da4a8
chore: update workflows config.
jaywcjlove Feb 25, 2022
a0c451d
chore: update workflows config.
jaywcjlove Feb 25, 2022
1262f0c
chore: update workflows config.
jaywcjlove Feb 25, 2022
4fe82d3
chore: update workflows config.
jaywcjlove Feb 25, 2022
98f2466
chore: update workflows config.
jaywcjlove Feb 25, 2022
417e15c
chore: update workflows config.
jaywcjlove Feb 25, 2022
0579d7c
chore: update workflows config.
jaywcjlove Feb 25, 2022
7a91877
chore: update workflows config.
jaywcjlove Feb 25, 2022
f935e17
chore: update workflows config.
jaywcjlove Feb 25, 2022
7489e55
chore: update workflows config.
jaywcjlove Feb 25, 2022
70b1822
chore: update workflows config.
jaywcjlove Feb 25, 2022
6bbcca7
chore: update workflows config.
jaywcjlove Feb 25, 2022
f831b66
chore: update workflows config.
jaywcjlove Feb 25, 2022
9ef151d
chore: update workflows config.
jaywcjlove Feb 25, 2022
6c55d40
chore: update workflows config.
jaywcjlove Feb 25, 2022
2723b9e
chore: update workflows config.
jaywcjlove Feb 25, 2022
a878dc4
chore: update workflows config.
jaywcjlove Feb 25, 2022
ef0a14e
chore: update workflows config.
jaywcjlove Feb 25, 2022
83f4038
chore: update workflows config.
jaywcjlove Feb 25, 2022
b10d4c0
chore: update workflows config.
jaywcjlove Feb 25, 2022
231b12f
chore: update workflows config.
jaywcjlove Feb 25, 2022
fb347fb
chore: update workflows config.
jaywcjlove Feb 25, 2022
76fa6b8
chore: update workflows config.
jaywcjlove Feb 25, 2022
c80a5f5
chore: update workflows config.
jaywcjlove Feb 25, 2022
60e6943
chore: update workflows config.
jaywcjlove Feb 25, 2022
4b90347
chore: update workflows config.
jaywcjlove Feb 25, 2022
fdd5ef5
chore: update workflows config.
jaywcjlove Feb 25, 2022
86e52a2
chore: update workflows config.
jaywcjlove Feb 25, 2022
5514810
chore: update workflows config.
jaywcjlove Feb 25, 2022
2943c9c
docs(SearchTree): 文档整理
nullptr-z Mar 2, 2022
4a0d5e9
doc(Tag): 修复文档示例错误 (#599)
gssggssg Mar 3, 2022
1a32f2c
Revert "doc(Tag): 修复文档示例错误 (#599)" (#600)
jaywcjlove Mar 3, 2022
f9c79d0
doc(Tag): 修复文档示例错误 (#599)
gssggssg Mar 3, 2022
1bca790
Revert "doc(Tag): 修复文档示例错误 (#599)" (#600)
jaywcjlove Mar 3, 2022
34558b5
暂存
nullptr-z Mar 3, 2022
a54ba32
clean:无效代码
nullptr-z Mar 4, 2022
f2cbada
feat(Tabs): 选项卡过多,超过宽度时,收缩超出部分 #559 (#626)
nullptr-z Mar 8, 2022
58f0273
fix(SearchTree): 修复数字key为0导致无法选中问题
nullptr-z Mar 8, 2022
31d7d3e
fix(Drawer): 修复层级问题,Dropdown被遮挡 #620
nullptr-z Mar 8, 2022
a879cfd
revert:撤销
nullptr-z Mar 8, 2022
d342a3a
fix(Drawer): 修复层级问题,Dropdown被遮挡 #620
nullptr-z Mar 8, 2022
0188387
feat(SearchTree): 操作流程优化 #629 #631
nullptr-z Mar 8, 2022
f8826bd
chore(Form): Select 跟Input 在表单中使用,错误样式统一 #622 (#628)
cuilanxin Mar 8, 2022
11ba558
Merge branch 'master' of github.com:nullptr-z/uiw
nullptr-z Mar 8, 2022
fd0a096
fix react-search-tree: remove remark
nullptr-z Mar 8, 2022
2abc44b
merge code & fix conflict
nullptr-z Mar 8, 2022
d1d871c
style(Tabs): 收缩菜单优化
nullptr-z Mar 9, 2022
93c7d8b
Merge branch 'master' of github.com:uiwjs/uiw
nullptr-z Mar 9, 2022
e4ca65a
clean:删除调试代码
nullptr-z Mar 9, 2022
a0729dd
chore: 更改'提交问题'链接地址
nullptr-z Mar 9, 2022
7b2322e
Merge branch 'master' of github.com:uiwjs/uiw
nullptr-z Mar 9, 2022
5310ac1
fix(SearchSelect): 修复单选模式无法显示初始lable问题 & 文档补全
nullptr-z Mar 9, 2022
b4fbc94
feat(SearchSelect): 和SearchTree统一操作流程
nullptr-z Mar 9, 2022
68ff63b
Merge branch 'master' of github.com:uiwjs/uiw
nullptr-z Mar 9, 2022
ffdac73
fix(SearchSelect): 修复单选模式无法显示初始lable问题 & 文档补全
nullptr-z Mar 9, 2022
c23780d
feat(SearchSelect): 和SearchTree统一操作流程
nullptr-z Mar 9, 2022
8fabe48
Merge branch 'master' of github.com:nullptr-z/uiw
nullptr-z Mar 9, 2022
65bbf59
docs(FileInput): 补全示例文档 #642
nullptr-z Mar 9, 2022
cfb7aa3
Merge branch 'master' of github.com:uiwjs/uiw
nullptr-z Mar 9, 2022
3e24b03
fix(SearchTree): 修复数字key无法被选中问题&增加示例文档
nullptr-z Mar 9, 2022
a37997c
Merge branch 'master' of github.com:uiwjs/uiw
nullptr-z Mar 9, 2022
c90aab2
fix(SearchTree): 修复数字key无法被选中问题&增加示例文档
nullptr-z Mar 9, 2022
9fabded
Merge branch 'master' of github.com:nullptr-z/uiw
nullptr-z Mar 9, 2022
fa49290
fix(Tree): 节点key为0时children无法渲染 #619
nullptr-z Mar 9, 2022
f94765b
style(Progress): 进度起始和末尾圆角溢出
nullptr-z Mar 10, 2022
51b8570
Merge branch 'master' of github.com:uiwjs/uiw
nullptr-z Mar 9, 2022
1c74dd2
Merge branch 'master' of github.com:nullptr-z/uiw
nullptr-z Mar 9, 2022
2484e75
style(Progress): 进度起始和末尾圆角溢出
nullptr-z Mar 10, 2022
902ddf3
Merge branch 'master' of github.com:nullptr-z/uiw
nullptr-z Mar 10, 2022
2f6bbd9
fix(SearchSelect): 清空操作不再展开下拉选项&文档补全
nullptr-z Mar 10, 2022
bdf16c5
Merge branch 'master' of github.com:uiwjs/uiw
nullptr-z Mar 9, 2022
3cca5d2
Merge branch 'master' of github.com:nullptr-z/uiw
nullptr-z Mar 9, 2022
63b25e6
Merge branch 'master' of github.com:nullptr-z/uiw
nullptr-z Mar 10, 2022
8c22baf
fix(SearchSelect): 清空操作不再展开下拉选项&文档补全
nullptr-z Mar 10, 2022
8ffee07
Merge branch 'master' of github.com:nullptr-z/uiw
nullptr-z Mar 10, 2022
978175a
fix(Popover): 修复children为Icon弹窗无法准确定位问题 #639
nullptr-z Mar 10, 2022
2e7ad2b
fix:处理冲突
nullptr-z Mar 10, 2022
b6f61a4
Merge branch 'master' of github.com:nullptr-z/uiw into HEAD
nullptr-z Mar 10, 2022
af445d6
docs(Popover): 文档格式化
nullptr-z Mar 10, 2022
ec8b990
fix: 处理冲突
nullptr-z Mar 10, 2022
b8142e0
fix(SearchSelect): 修复form在没有initValue情况默认赋值了空字符串问题
nullptr-z Mar 10, 2022
490c716
feat(Transfer): 增加双栏穿梭选择框
nullptr-z Mar 15, 2022
84709e7
fix:处理冲突
nullptr-z Mar 15, 2022
3554a37
暂存
nullptr-z Mar 15, 2022
4dcb812
feat(Transfer): 增加选项搜索功能
nullptr-z Mar 15, 2022
0998fd1
fix:处理冲突
nullptr-z Mar 15, 2022
041c331
chore: 依赖撤销
nullptr-z Mar 15, 2022
ff1791f
chore:transfer组件发布
nullptr-z Mar 16, 2022
9ed78ee
Merge branch 'master' of github.com:uiwjs/uiw
nullptr-z Mar 16, 2022
2a983cb
fix(Transfer): 选项为多层tree时总数统计错误
nullptr-z Mar 16, 2022
d2f7963
Merge branch 'master' of github.com:uiwjs/uiw
nullptr-z Mar 16, 2022
4d860c3
docs(Transfer): 文档与菜单统一名称
nullptr-z Mar 16, 2022
9fe6b31
Merge branch 'master' of github.com:uiwjs/uiw
nullptr-z Mar 16, 2022
cb67596
docs(Steps):示例文档错误
nullptr-z Mar 16, 2022
21475b4
Merge branch 'master' of github.com:uiwjs/uiw
nullptr-z Mar 16, 2022
55516d0
style(Transfer): 添加穿梭箭头边框样式
nullptr-z Mar 16, 2022
6984731
Merge branch 'master' of github.com:uiwjs/uiw
nullptr-z Mar 16, 2022
12851d6
feat(Transfer): 增加选项栏全选功能
nullptr-z Mar 16, 2022
01196dc
fix:处理冲突冲突
nullptr-z Mar 16, 2022
e989aa1
style:样式调整
nullptr-z Mar 16, 2022
68b17b0
faeat(Transfer): 添加Tree节点多选支持
nullptr-z Mar 16, 2022
3ccfbf1
fix:处理冲突
nullptr-z Mar 16, 2022
ded38f2
style(Transfer): 添加选中样式
nullptr-z Mar 17, 2022
d2e2584
fix(Transfer): 潜在bug
nullptr-z Mar 17, 2022
2324def
fix(Transfer): 修复潜在BUG
nullptr-z Mar 17, 2022
837de85
fix:处理冲突
nullptr-z Mar 17, 2022
4b39e45
style(Tree): Tree没有子节点时展开箭头不再占位 #641
nullptr-z Mar 17, 2022
0bb7798
Merge branch 'master' of github.com:uiwjs/uiw
nullptr-z Mar 17, 2022
fa39f42
fix(Tree): 被隐藏(hideNode)的子节点,勾选父节点时,不再选中
nullptr-z Mar 17, 2022
9684814
Merge branch 'master' of github.com:uiwjs/uiw
nullptr-z Mar 17, 2022
e27fbe6
fix(Transfer): 修复Map对象引用拷贝导致的BUG
nullptr-z Mar 17, 2022
66f57a1
fix:处理冲突
nullptr-z Mar 17, 2022
946c721
fix(SearchSelect): 样式调整 #652
nullptr-z Mar 18, 2022
8a029f5
Merge branch 'master' of github.com:uiwjs/uiw
nullptr-z Mar 18, 2022
f43c041
faeat(Carousel): 增加走马灯组件Carousel
nullptr-z Mar 18, 2022
c96af8b
clean:删除多余包引用
nullptr-z Mar 18, 2022
882160f
Merge branch 'master' of github.com:uiwjs/uiw
nullptr-z Mar 18, 2022
ba90c6c
chore: 添加发布代码
nullptr-z Mar 18, 2022
e3dcb66
fix: 代码格式调整
nullptr-z Mar 18, 2022
0e908fa
docs: 文字描述错误
nullptr-z Mar 18, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/deploy.yml
Expand Up @@ -123,6 +123,11 @@ jobs:
with:
token: ${{ secrets.NPM_TOKEN }}
package: ./packages/react-card/package.json
- name: 📦 @uiw/react-carousel publish to NPM
uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_TOKEN }}
package: ./packages/react-carousel/package.json
- name: 📦 @uiw/react-checkbox publish to NPM
uses: JS-DevTools/npm-publish@v1
with:
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/npm.yml
Expand Up @@ -192,6 +192,11 @@ jobs:
with:
token: ${{ secrets.NPM_TOKEN }}
package: ./packages/react-card/package.json
- name: 📦 @uiw/react-carousel publish to NPM
uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_TOKEN }}
package: ./packages/react-carousel/package.json
- name: 📦 @uiw/react-checkbox publish to NPM
uses: JS-DevTools/npm-publish@v1
with:
Expand Down
140 changes: 140 additions & 0 deletions packages/react-carousel/README.md
@@ -0,0 +1,140 @@
Carousel 走马灯
===

[![Open in unpkg](https://img.shields.io/badge/Open%20in-unpkg-blue)](https://uiwjs.github.io/npm-unpkg/#/pkg/@uiw/react-carousel/file/README.md)
[![NPM Downloads](https://img.shields.io/npm/dm/@uiw/react-carousel.svg?style=flat)](https://www.npmjs.com/package/@uiw/react-carousel)
[![npm version](https://img.shields.io/npm/v/@uiw/react-carousel.svg?label=@uiw/react-carousel)](https://npmjs.com/@uiw/react-carousel)

滚动播放。在 v4.15.0+ 添加。

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nullptr-z 添加安装文档,组件添加到 uiw 包中。

## 基础用法

最简单的用法。

<!--rehype:bgWhite=true&codeSandbox=true&codePen=true-->
```jsx
import React from 'react';
import { Carousel } from 'uiw';

function Demo() {
return (
<Carousel>
<div style={{ height: '100%', background: '#1EABCD' }}>
<span>1</span>
</div>
<div style={{ height: '100%', background: '#393b46' }}>
<span>2</span>
</div>
<div style={{ height: '100%', background: '#008EF0' }}>
<span>3</span>
</div>
<div style={{ height: '100%', background: '#393E48' }}>
<span>4</span>
</div>
</Carousel>
);
}

ReactDOM.render(<Demo />, _mount_);
```

## 控制播放频率

palyTime设置每帧停留时间,scrollTime设置切换帧的速度

<!--rehype:bgWhite=true&codeSandbox=true&codePen=true-->
```jsx
import React from 'react';
import { Carousel } from 'uiw';

function Demo() {
return (
<Carousel palyTime={1000} scrollTime={500}>
<div style={{ height: '100%', background: '#1EABCD' }}>
<span>1</span>
</div>
<div style={{ height: '100%', background: '#393b46' }}>
<span>2</span>
</div>
<div style={{ height: '100%', background: '#008EF0' }}>
<span>3</span>
</div>
<div style={{ height: '100%', background: '#393E48' }}>
<span>4</span>
</div>
</Carousel>
);
}

ReactDOM.render(<Demo />, _mount_);
```

## 切换到指定帧

手动切换到指定帧的位置

<!--rehype:bgWhite=true&codeSandbox=true&codePen=true-->
```jsx
import React from 'react';
import { Carousel } from 'uiw';

function Demo() {

const ref=React.useRef()
const [autoPlay,autoPlaySet]=React.useState(true)

return (
<React.Fragment>
<Carousel ref={ref} position={2} autoPlay={autoPlay}>
<div style={{ height: '100%', background: '#1EABCD' }}>
<span>1</span>
</div>
<div style={{ height: '100%', background: '#393b46' }}>
<span>2</span>
</div>
<div style={{ height: '100%', background: '#008EF0' }}>
<span>3</span>
</div>
<div style={{ height: '100%', background: '#393E48' }}>
<span>4</span>
</div>
</Carousel>
<button onClick={() => ref.current.gotoSlide(1)}>跳转</button>
<button onClick={() => ref.current.prevSlide()}>上一张</button>
<button onClick={() => ref.current.nextSlide()}>下一张</button>
<button onClick={() =>autoPlaySet(autoPlay?false:true)}>{autoPlay?'暂停':'开始'}</button>
</React.Fragment>
);
}

ReactDOM.render(<Demo />, _mount_);
```

## Props

## API

| 参数 | 说明 | 类型 | 默认值 |
|--------- |-------- |--------- |-------- |
| width | 宽度 | number | 400 |
| height | 高度 | number | 200 |
| position | 设置初始帧位置 | number | 0 |
| palyTime | 每帧停留时间(ms) | number | 2000 |
| scrollTime | 滚动动画的速度(ms) | number | 200 |
| autoPlay | 是否自动播放 | boolean | true |


### ref

```ts
// 跳转到指定帧
gotoSlide: (slideNumber: number) => void;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nullptr-z Markdown 样式 格式化一下。

// 上一针
prevSlide: () => void;
// 下一帧
nextSlide: () => void;
// 暂停播放
stopPlay: () => void;
```


47 changes: 47 additions & 0 deletions packages/react-carousel/package.json
@@ -0,0 +1,47 @@
{
"name": "@uiw/react-carousel",
"version": "4.14.2",
"description": "Carousel component",
"homepage": "https://uiwjs.github.io/#/components/carousel",
"repository": {
"type": "git",
"url": "https://github.com/uiwjs/uiw.git"
},
"license": "MIT",
"main": "cjs/index.js",
"module": "esm/index.js",
"files": [
"dist.css",
"cjs",
"esm",
"src"
],
"publishConfig": {
"access": "public"
},
"keywords": [
"carousel",
"design",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nullptr-z 没有走马灯关键字

"uiw",
"uiw-react",
"react.js",
"react",
"react-component",
"component",
"components",
"ui",
"css",
"uikit",
"react-ui",
"framework",
"front-end",
"frontend"
],
"peerDependencies": {
"react": ">=16.9.0",
"react-dom": ">=16.9.0"
},
"dependencies": {
"@uiw/utils": "^4.14.2"
}
}
103 changes: 103 additions & 0 deletions packages/react-carousel/src/index.tsx
@@ -0,0 +1,103 @@
import React, { useEffect, useMemo, useRef, useState } from 'react';
import { IProps, HTMLDivProps } from '@uiw/utils';
import './style/index.less';

export interface CarouselProps extends IProps, HTMLDivProps {
width?: number;
height?: number;
position?: number;
palyTime?: number;
scrollTime?: number;
autoPlay?: boolean;
}

export interface CarouselRef {
gotoSlide: (slide: number, dontAnimate?: boolean) => void;
prevSlide: () => void;
nextSlide: () => void;
stopPlay: () => void;
}

function Carousel(props: CarouselProps, ref: CarouselRef) {
const {
position = 0,
width = 400,
height = 200,
palyTime = 2000,
scrollTime = 200,
autoPlay = true,

prefixCls = 'w-carousel',
className,
style,
} = props;

const cls = useMemo(() => [prefixCls, className].filter(Boolean).join(' ').trim(), [prefixCls, className]);

const [currentPosition, currentPositionSet] = useState(position);
const positionRef = useRef(currentPosition);
const childCount = React.Children.count(props.children);
const stopPlay = useRef<Function>(() => {});

React.useImperativeHandle(
ref,
() => ({
gotoSlide,
prevSlide: () => gotoSlide(positionRef.current - 1),
nextSlide: () => gotoSlide(positionRef.current + 1),
stopPlay: () => stopPlay.current(),
}),
[ref],
);

const gotoSlide = (slidNumber: number) => {
stopPlay.current();
const maxSlid = childCount - 1;
let slidNumberTemp = slidNumber > maxSlid ? maxSlid : slidNumber;
slidNumberTemp = slidNumber < 0 ? 0 : slidNumberTemp;
positionRef.current = slidNumberTemp;
currentPositionSet(slidNumberTemp);
play();
};

const play = (ms: number = palyTime) => {
if (autoPlay) {
const time = setInterval(() => {
positionRef.current++;
if (positionRef.current >= childCount) {
positionRef.current = 0;
}
currentPositionSet(positionRef.current);
}, ms);
stopPlay.current = () => {
clearInterval(time);
};
}
};

useEffect(() => {
play();
return () => {
stopPlay.current();
};
}, [autoPlay]);

return (
<div className={cls} style={{ width, height }}>
<div
className={`${cls}-content`}
style={{
width: width * childCount,
transform: `translate3d(${-(currentPosition * width)}px, 0px, 0px)`,
transition: `${scrollTime * 0.001}s ease-in-out`,
}}
>
{React.Children.map(props.children, (child) => {
return <div style={{ width, height, ...style }}>{child}</div>;
})}
</div>
</div>
);
}

export default React.forwardRef<CarouselRef, CarouselProps>(Carousel);
13 changes: 13 additions & 0 deletions packages/react-carousel/src/style/index.less
@@ -0,0 +1,13 @@
@w-carousel: ~'w-carousel';

.@{w-carousel} {
overflow: hidden;

&-content {
height: 200px;
// transform: translate3d();
display: flex;
flex-direction: row;
transition: 0.6s ease-in-out;
}
}
8 changes: 8 additions & 0 deletions packages/react-carousel/tsconfig.json
@@ -0,0 +1,8 @@
{
"extends": "../../tsconfig",
"include": ["src/**/*"],
"compilerOptions": {
"outDir": "./cjs",
"baseUrl": "."
}
}
1 change: 0 additions & 1 deletion packages/react-transfer/package.json
Expand Up @@ -44,7 +44,6 @@
"dependencies": {
"@uiw/react-card": "^4.14.2",
"@uiw/react-checkbox": "^4.14.2",
"@uiw/react-grid": "^4.14.2",
"@uiw/react-icon": "^4.14.2",
"@uiw/react-input": "^4.14.2",
"@uiw/react-tree": "^4.14.2",
Expand Down
1 change: 1 addition & 0 deletions packages/uiw/package.json
Expand Up @@ -67,6 +67,7 @@
"@uiw/react-button-group": "^4.14.2",
"@uiw/react-calendar": "^4.14.2",
"@uiw/react-card": "^4.14.2",
"@uiw/react-carousel": "^4.14.2",
"@uiw/react-checkbox": "^4.14.2",
"@uiw/react-collapse": "^4.14.2",
"@uiw/react-copy-to-clipboard": "^4.14.2",
Expand Down
2 changes: 2 additions & 0 deletions packages/uiw/src/index.ts
Expand Up @@ -9,6 +9,7 @@ export * from '@uiw/react-button';
export * from '@uiw/react-button-group';
export * from '@uiw/react-calendar';
export * from '@uiw/react-card';
export * from '@uiw/react-carousel';
export * from '@uiw/react-checkbox';
export * from '@uiw/react-collapse';
export * from '@uiw/react-copy-to-clipboard';
Expand Down Expand Up @@ -69,6 +70,7 @@ export { default as Button } from '@uiw/react-button';
export { default as ButtonGroup } from '@uiw/react-button-group';
export { default as Calendar } from '@uiw/react-calendar';
export { default as Card } from '@uiw/react-card';
export { default as Carousel } from '@uiw/react-carousel';
export { default as Checkbox } from '@uiw/react-checkbox';
export { default as Collapse } from '@uiw/react-collapse';
export { default as CopyToClipboard } from '@uiw/react-copy-to-clipboard';
Expand Down
1 change: 1 addition & 0 deletions website/src/menu.json
Expand Up @@ -70,6 +70,7 @@
{ "name": "Avatar 头像", "path": "avatar" },
{ "name": "Badge 标记", "path": "badge" },
{ "name": "Card 卡片", "path": "card" },
{ "name": "Carousel 走马灯", "path": "carousel" },
{ "name": "Collapse 折叠面板", "path": "collapse" },
{ "name": "Descriptions 描述列表", "path": "descriptions" },
{ "name": "Tag 标签", "path": "tag" },
Expand Down
2 changes: 2 additions & 0 deletions website/src/routers.tsx
Expand Up @@ -34,6 +34,7 @@ const Checkbox = Loadable(lazy(() => import('./routes/components/checkbox')));
const CopyToClipboard = Loadable(lazy(() => import('./routes/components/copy-to-clipboard')));
const Collapse = Loadable(lazy(() => import('./routes/components/collapse')));
const Card = Loadable(lazy(() => import('./routes/components/card')));
const Carousel = Loadable(lazy(() => import('./routes/components/carousel')));
const Descriptions = Loadable(lazy(() => import('./routes/components/descriptions')));
const Loader = Loadable(lazy(() => import('./routes/components/loader')));
const Icon = Loadable(lazy(() => import('./routes/components/icon')));
Expand Down Expand Up @@ -126,6 +127,7 @@ export const routes: RouteObject[] = [
{ path: '/components/copy-to-clipboard', element: <CopyToClipboard /> },
{ path: '/components/collapse', element: <Collapse /> },
{ path: '/components/card', element: <Card /> },
{ path: '/components/carousel', element: <Carousel /> },
{ path: '/components/descriptions', element: <Descriptions /> },
{ path: '/components/loader', element: <Loader /> },
{ path: '/components/icon', element: <Icon /> },
Expand Down