Skip to content

Commit 51f7e7d

Browse files
committed
Merge branch 'develop' into feat/react-19/support
2 parents 809766f + a35634a commit 51f7e7d

File tree

103 files changed

+10864
-1602
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+10864
-1602
lines changed

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,22 @@ toc: false
55
spline: explain
66
---
77

8+
## 🌈 0.15.0 `2025-05-29`
9+
### 🚀 Features
10+
- `ImageViewer`: 新增图片预览组件 @novlan1 ([#607](https://github.com/Tencent/tdesign-mobile-react/pull/607))
11+
### 🐞 Bug Fixes
12+
- `TabPanel`: 修复组件内容未展示的问题 @betavs ([#638](https://github.com/Tencent/tdesign-mobile-react/pull/638))
13+
14+
## 🌈 0.14.0 `2025-05-16`
15+
### 🚀 Features
16+
- `Cascader`: 新增 `Cascader` 组件 @ming680 @anlyyao ([#475](https://github.com/Tencent/tdesign-mobile-react/pull/475))
17+
- `DropdownMenu`: 新增 `DropdownMenu` 组件 @ming680 @anlyyao ([#503](https://github.com/Tencent/tdesign-mobile-react/pull/503))
18+
- `Overlay`: 新增遮罩动画系列回调函数,包括 `onOpen``onOpened``onClose``onClosed` 事件 @anlyyao ([#629](https://github.com/Tencent/tdesign-mobile-react/pull/629))
19+
- `PullDownRefresh`: 新增 `disabled` 属性 @anlyyao ([#631](https://github.com/Tencent/tdesign-mobile-react/pull/631))
20+
### 🐞 Bug Fixes
21+
- `Button`: 修复按钮点击态样式缺失 @anlyyao ([#627](https://github.com/Tencent/tdesign-mobile-react/pull/627))
22+
- `Steps`: 修复内置图标无效的问题 @anlyyao ([#635](https://github.com/Tencent/tdesign-mobile-react/pull/635))
23+
824
## 🌈 0.13.2 `2025-04-25`
925
### 🚀 Features
1026
- `Icon`: 新增 `logo-miniprogram``logo-cnb``seal``quote` 图标 @taowensheng1997 @uyarn ([#621](https://github.com/Tencent/tdesign-mobile-react/pull/621))

CONTRIBUTING.md

Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
# CONTRIBUTING
2+
3+
`tdesign-mobile-react` 包含 `Mobile React` 代码和一个子仓库,子仓库指向 `tdesign-common` 仓库
4+
5+
## 开发
6+
7+
建议使用 node 18 版本进行开发
8+
9+
### 1.初始化子仓库
10+
11+
```bash
12+
npm run init
13+
```
14+
15+
### 2.安装依赖
16+
17+
```bash
18+
npm i
19+
```
20+
21+
### 3.本地开发
22+
23+
```bash
24+
npm run start
25+
```
26+
27+
完成以上 3 个步骤,浏览器访问 <http://127.0.0.1:19000> 即可调该框架的任何内容
28+
29+
## 目录结构
30+
31+
```text
32+
├── script // 构建代码
33+
├── site // 站点代码
34+
├── src // 组件代码
35+
└─ componentA
36+
├── _example // 组件示例文档
37+
└─ __test__ // 组件测试用例
38+
└─ test // 测试配置文件
39+
```
40+
41+
### 组件页路由配置
42+
43+
每一个组件都有自己的路由,页面配置都是一个 `Markdown` 文件,如`button.md`,具体路径可参考 `/site/web/site.config.js`。如果有新增组件,直接按照模板添加即可
44+
45+
```js
46+
{
47+
title: '基础组件',
48+
type: 'component', // 组件文档
49+
children: [
50+
{
51+
title: 'Button 按钮',
52+
name: 'button',
53+
component: () => import(`tdesign-mobile-react/button/button.md`),
54+
},
55+
{
56+
title: 'Icon 图标',
57+
name: 'icon',
58+
component: () => import(`tdesign-mobile-react/icon/icon.md`),
59+
},
60+
...
61+
],
62+
},
63+
```
64+
65+
### Markdown 文件的 demo 引用
66+
67+
文档 `demo` 排列与 `common` 子仓库中的 `UI demo` 展示一致,如 `button` 组件页面的展示顺序,由子仓库的 `docs/mobile/api/button.md` 内的顺序决定。
68+
69+
```markdown
70+
{{ base }}
71+
[demo 描述(可不填)]
72+
```
73+
74+
### Demo 调试
75+
76+
我们可以通过打开组件的路由页进行开发调试,如 `button`,则打开 <http://127.0.0.1:19000/mobile-vue/components/button> 进行开发调试;
77+
78+
如果仅想聚焦于对某个 `demo` 单独调试,如 `button`, 则可以打开 <http://127.0.0.1:19000/mobile.html#/button> 进行开发调试。
79+
80+
81+
## 子仓库 tdesign-common
82+
83+
TDesign 的项目都会以子仓库的形式引入 `tdesign-common` 公共仓库,对应 `src/\_common` 文件夹,
84+
公共仓库中包含
85+
86+
- 部分组件的一些框架无关的公共的工具函数
87+
- `组件库UI`,既 `html` 结构和 `css` 样式(多框架共用)
88+
89+
大部分的功能和改动都只需要调整主仓库的代码即可,但涉及部分公共函数、样式或者部分文档的调整,需要改动子仓库的代码。
90+
91+
### 初始化子仓库
92+
93+
- 如开发部分提到的,初次克隆代码后需要初始化子仓库: `git submodule init && git submodule update`
94+
- `git submodule update` 之后子仓库不指向任何分支,只是一个指向某一个提交的游离状态
95+
96+
### 子仓库开发
97+
98+
子仓库组件分支从 `develop checkout` 示例:`feature/button`,提交代码时先进入子仓库完成提交,然在回到主仓库完成提交
99+
100+
- 先进入 `src/\_common` 文件夹,正常将样式修改添加提交
101+
- 回到主仓库,此时应该会看到 `src/\_common` 文件夹是修改状态,按照正常步骤添加提交即可
102+
103+
104+
### 组件库 UI
105+
106+
`UI` 是多个框架共用的,比如 `PC` 端的 `react/vue/vue-next` 都是复用子仓库的 `UI` 代码。
107+
各个框架组件实现应该要复用 `UI` 开发的 `html` 结构,引用其组件 `CSS``Demo CSS`(本仓库已在入口处引用了),`UI` 开发一般可由单独的 UI 开发同学认领完成或各框架组件开发同学的其中一名同学完成
108+
109+
- 如果开发前已有某个组件的 `UI` 开发内容,直接在主仓库使用即可
110+
- 如果没有,且你也负责 `UI` 开发:参考 `UI` 开发规范完成 `UI` 开发内容、然后再开发主仓库组件
111+
- 如果没有,且 `UI` 开发工作已有其他同学负责或认领:可以先在主仓库开发组件功能,待 `UI` 开发输出之后对齐即可
112+
113+
如果 `UI` 内容和样式(其他同学负责开发)还未完成,而你开发组件功能时需要写一些样式,可以直接在组件文件夹先写一个临时的 `less` 文件,在 `js` 中引入即可,如:
114+
115+
```bash
116+
├── button.less
117+
├── button.tsx
118+
```
119+
120+
```js
121+
// button.tsx
122+
123+
// 先引入临时的样式文件用于开发功能,待 UI 开发完成之后需要与 UI 样式对齐并删除 less 文件
124+
import './button.less';
125+
```
126+
127+
## 分支规范
128+
129+
### 分支
130+
131+
遵循使用 `git flow` 规范,新组件分支从 `develop checkout`[https://nvie.com/posts/a-successful-git-branching-model/](https://nvie.com/posts/a-successful-git-branching-model/)
132+
133+
如果是贡献组件,则从 `develop checkout` 分支如:`feature/button`,记得如果同时要在子仓库开发 `UI`,子仓库也要 `checkout` 同名分支
134+
135+
> 关于 fork
136+
137+
以下内容处理 `fork` 仓库后,远端仓库的更新如何同步到 `fork` 仓库
138+
139+
```bash
140+
# 建立 upstream remote
141+
git remote add upstream git@github.com:Tencent/tdesign-mobile-react.git
142+
143+
# 更新 upstream
144+
git fetch upstream develop
145+
146+
# 合并 upstream develop 到本地
147+
git checkout develop
148+
149+
git merge upstream/develop
150+
```
151+
152+
### 提交说明
153+
154+
项目使用基于 angular 提交规范:[https://github.com/conventional-changelog/commitlint/tree/master/@commitlint/config-conventional](https://github.com/conventional-changelog/commitlint/tree/master/@commitlint/config-conventional)
155+
156+
每次提交会自动触发提交验证
157+
158+
- 使用工具 `commitizen` 协助规范 `git commit` 信息
159+
- `fix` & `feat` 的提交会被用来生成 `changelog`
160+
- 提交会触发 `git pre-commit` 检查,修复提示的 `eslint` 错误,
161+
162+
## 开发规范
163+
164+
### API 规范
165+
166+
`API``API` 平台统一管理生成,如果涉及组件文档的改动(如`src/button/type.ts`的内容),都需要同时在 `API` 平台提交 `PR`,进行统一维护管理 https://github.com/tdesignoteam/tdesign-api
167+
168+
### 前缀规范
169+
170+
组件和 `CSS` 前缀以 `t-` 开头,无论 `js` 还是 `css` 都使用变量定义前缀,方便后续替换
171+
172+
### CSS 规范
173+
174+
175+
组件样式在 `common` 子仓库开发,遵循 [tdesign-common 仓库 UI 开发规范](https://github.com/Tencent/tdesign-common/blob/main/style/mobile/README.md)

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,22 @@ TDesign 适配移动端的组件库,适合在 React 16.x 技术栈项目中使
3838
| -- | -- | -- | -- |
3939
| IE11, Edge | last 3 versions | last 3 versions | last 2 versions |
4040

41+
# 贡献成员
42+
43+
<a href="https://openomy.app/github/tencent/tdesign-mobile-react" target="_blank">
44+
<img src="https://openomy.app/svg?repo=tencent/tdesign-mobile-react&chart=bubble&latestMonth=12" alt="Contribution Leaderboard" />
45+
</a>
46+
47+
# 参与贡献
48+
49+
TDesign 欢迎任何愿意参与贡献的参与者。如果需要本地运行代码或参与贡献,请先阅读[参与贡献](https://github.com/Tencent/tdesign-mobile-react/blob/develop/CONTRIBUTING.md)
50+
51+
# 反馈
52+
53+
有任何问题,建议通过 [Github issues](https://github.com/Tencent/tdesign-mobile-react/issues) 反馈或扫码加入用户微信群。
54+
55+
<img src="https://raw.githubusercontent.com/Tencent/tdesign/main/packages/components/src/images/groups/react-group.png" width="200" />
56+
4157
# 开源协议
4258

4359
TDesign 遵循 [MIT 协议](https://github.com/Tencent/tdesign-mobile-react/LICENSE)

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "tdesign-mobile-react",
3-
"version": "0.13.2",
3+
"version": "0.15.0",
44
"description": "TDesign Component for Mobile React",
55
"title": "tdesign-mobile-react",
66
"main": "cjs/index.js",
@@ -113,6 +113,7 @@
113113
"concurrently": "^6.4.0",
114114
"cross-env": "^7.0.3",
115115
"cssnano": "^5.0.12",
116+
"csstype": "^3.1.3",
116117
"cz-conventional-changelog": "^3.3.0",
117118
"dom-parser": "^0.1.6",
118119
"eslint": "^8.4.1",

site/mobile/mobile.config.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ export default {
4545
name: 'image',
4646
component: () => import('tdesign-mobile-react/image/_example/index.tsx'),
4747
},
48+
{
49+
title: 'ImageViewer 图片预览',
50+
name: 'image-viewer',
51+
component: () => import('tdesign-mobile-react/image-viewer/_example/index.tsx'),
52+
},
4853
{
4954
title: 'Overlay 遮罩层',
5055
name: 'overlay',
@@ -132,6 +137,11 @@ export default {
132137
name: 'back-top',
133138
component: () => import('tdesign-mobile-react/back-top/_example/index.tsx'),
134139
},
140+
{
141+
title: 'Cascader 级联选择器',
142+
name: 'cascader',
143+
component: () => import('tdesign-mobile-react/cascader/_example/index.tsx'),
144+
},
135145
{
136146
title: 'Checkbox 多选框',
137147
name: 'checkbox',
@@ -142,6 +152,11 @@ export default {
142152
name: 'dialog',
143153
component: () => import('tdesign-mobile-react/dialog/_example/index.tsx'),
144154
},
155+
{
156+
title: 'DropdownMenu 下拉菜单',
157+
name: 'dropdown-menu',
158+
component: () => import('tdesign-mobile-react/dropdown-menu/_example/index.tsx'),
159+
},
145160
{
146161
title: 'Loading 加载中',
147162
name: 'loading',

site/web/site.config.js

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -191,12 +191,14 @@ export const docs = [
191191
component: () => import('tdesign-mobile-react/calendar/calendar.md'),
192192
componentEn: () => import('tdesign-mobile-react/calendar/calendar.en-US.md'),
193193
},
194-
// {
195-
// title: 'Cascader 级联选择器',
196-
// name: 'cascader',
197-
// path: '/mobile-react/components/cascader',
198-
// component: () => import('tdesign-mobile-react/cascader/cascader.md'),
199-
// },
194+
{
195+
title: 'Cascader 级联选择器',
196+
titleEn: 'Cascader',
197+
name: 'cascader',
198+
path: '/mobile-react/components/cascader',
199+
component: () => import('tdesign-mobile-react/cascader/cascader.md'),
200+
componentEn: () => import('tdesign-mobile-react/cascader/cascader.en-US.md'),
201+
},
200202
{
201203
title: 'CheckBox 多选框',
202204
titleEn: 'CheckBox',
@@ -382,12 +384,14 @@ export const docs = [
382384
component: () => import('tdesign-mobile-react/image/image.md'),
383385
componentEn: () => import('tdesign-mobile-react/image/image.en-US.md'),
384386
},
385-
// {
386-
// title: 'ImageViewer 图片预览',
387-
// name: 'image-viewer',
388-
// path: '/mobile-react/components/image-viewer',
389-
// component: () => import('tdesign-mobile-react/image-viewer/image-viewer.md'),
390-
// },
387+
{
388+
title: 'ImageViewer 图片预览',
389+
titleEn: 'ImageViewer',
390+
name: 'ImageViewer',
391+
path: '/mobile-react/components/image-viewer',
392+
component: () => import('tdesign-mobile-react/image-viewer/image-viewer.md'),
393+
componentEn: () => import('tdesign-mobile-react/image-viewer/image-viewer.en-US.md'),
394+
},
391395
{
392396
title: 'List 列表',
393397
name: 'list',
@@ -469,6 +473,12 @@ export const docs = [
469473
path: '/mobile-react/components/dialog',
470474
component: () => import('tdesign-mobile-react/dialog/dialog.md'),
471475
},
476+
{
477+
title: 'DropdownMenu 下拉菜单',
478+
name: 'dropdown-menu',
479+
path: '/mobile-react/components/dropdown-menu',
480+
component: () => import('tdesign-mobile-react/dropdown-menu/dropdown-menu.md'),
481+
},
472482
// {
473483
// title: 'DropdownMenu 下拉菜单',
474484
// name: 'dropdown-menu',

src/_common

Submodule _common updated 45 files

src/_util/useSwipe.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ export interface UseSwipeOptions {
3535
* 滑动结束时的回调函数
3636
*/
3737
onSwipeEnd?: (e: TouchEvent) => void;
38+
39+
/**
40+
* 是否禁用
41+
*/
42+
disabled?: boolean;
3843
}
3944

4045
/**
@@ -48,7 +53,7 @@ export function useSwipe(target: EventTarget | null | undefined, options = {} as
4853
const coordsStart = useRef<Position>({ x: 0, y: 0 }); // 用于存储触摸起始位置的坐标
4954
const coordsEnd = useRef<Position>({ x: 0, y: 0 }); // 用于存储触摸结束位置的坐标
5055
const coordsOffset = useRef<Position>({ x: 0, y: 0 }); // 用于存储滑动偏移量
51-
const { threshold = 0, onSwipe, onSwipeEnd, onSwipeStart, listenerOptions = { passive: true } } = options;
56+
const { threshold = 0, onSwipe, onSwipeEnd, onSwipeStart, listenerOptions = { passive: true }, disabled } = options;
5257

5358
const updateOffset = useCallback(() => {
5459
coordsOffset.current = {
@@ -95,6 +100,7 @@ export function useSwipe(target: EventTarget | null | undefined, options = {} as
95100
const onTouchStart = useCallback(
96101
(e: TouchEvent) => {
97102
if (e.touches.length !== 1) return;
103+
if (disabled) return;
98104
if (
99105
listenerOptions === true ||
100106
(isObject(listenerOptions) && listenerOptions.capture && listenerOptions.passive)
@@ -106,6 +112,7 @@ export function useSwipe(target: EventTarget | null | undefined, options = {} as
106112
updateCoordsEnd(x, y);
107113
onSwipeStart?.(e);
108114
},
115+
// eslint-disable-next-line react-hooks/exhaustive-deps
109116
[listenerOptions, updateCoordsStart, updateCoordsEnd, onSwipeStart],
110117
);
111118

src/action-sheet/_example/align.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ export default function ListExample() {
88
return (
99
<div className="action-sheet-demo">
1010
<div className="action-sheet-demo-btns">
11-
<Button block variant="outline" theme="primary" onClick={() => setAlignCenterVisible(true)}>
11+
<Button block size="large" variant="outline" theme="primary" onClick={() => setAlignCenterVisible(true)}>
1212
居中列表型
1313
</Button>
14-
<Button block variant="outline" theme="primary" onClick={() => setAlignLeftVisible(true)}>
14+
<Button block size="large" variant="outline" theme="primary" onClick={() => setAlignLeftVisible(true)}>
1515
左对齐列表型
1616
</Button>
1717
</div>

src/action-sheet/_example/grid-multiple.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export default function GridMultipleExample() {
88
return (
99
<div className="action-sheet-demo">
1010
<div className="action-sheet-demo-btns">
11-
<Button block variant="outline" theme="primary" onClick={() => setMultiPageVisible(true)}>
11+
<Button block size="large" variant="outline" theme="primary" onClick={() => setMultiPageVisible(true)}>
1212
宫格型-多页
1313
</Button>
1414
</div>

0 commit comments

Comments
 (0)