Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
b53321a
chore: update group code path (#759)
liweijie0812 Aug 29, 2025
d1b405a
test(layout): optimized the unit tests for the layout component (#749)
ImaginingMaker Aug 29, 2025
02b8a17
fix(steps): inconsistent rendering between string and number when the…
ImaginingMaker Sep 1, 2025
e361026
test(drawer): add unit test (#767)
Cyrios-ykx Sep 1, 2025
7db4ee4
test(steps): optimized the unit tests for the steps component (#765)
ImaginingMaker Sep 1, 2025
389aab8
test(component): add test case of stepper (#763)
xliudaxia Sep 1, 2025
ee8dc68
test(pull-down-refresh): add pull-down-refresh test (#774)
JustGenius-s Sep 3, 2025
80a7930
test(DropdownMenu): add test (#762)
RSS1102 Sep 3, 2025
877542a
更新`Image`组件示例对齐 (#769)
byq1213 Sep 3, 2025
cb26d86
test(table): add table test (#751)
Boomkaa Sep 3, 2025
2270812
test(cell): add cell test (#737)
Saraph1nes Sep 3, 2025
bef2e27
test(Qrcode): add qrcode's unit test (#731)
MeoRinLime Sep 3, 2025
ac1d4ed
feat(test): 新增 Rate 相关组件测试,优化提示框逻辑与安全访问 (#754)
lockiechen Sep 5, 2025
1314791
test(count-down): add count-down test (#697) (#781)
SinzoL Sep 11, 2025
fd8ee86
feat(Message): add unit test and fix problems (#779)
vancece Sep 12, 2025
a86e3cd
feat(icon): upgrade icon 0.6.x (#785)
liweijie0812 Sep 22, 2025
83214cb
fix(collapse): fix the behavior of the defaultExpandAll prop (#775)
ImaginingMaker Sep 24, 2025
dcced6f
chore: update snapshot (#794)
liweijie0812 Sep 24, 2025
c6018b6
feat(site): add a changelog for each component page (#793)
liweijie0812 Sep 29, 2025
a4e44aa
test(back-top): add test case for back-top (#791)
novlan1 Sep 29, 2025
73b5f9d
add cascader test case (#786)
novlan1 Sep 29, 2025
13f0dbe
test(Popover): add test for Popover (#697) (#782)
SinzoL Sep 29, 2025
70a0599
chore: merge deploy mode (#795)
anlyyao Sep 30, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README-zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ TDesign 欢迎任何愿意参与贡献的参与者。如果需要本地运行代

有任何问题,建议通过 [Github issues](https://github.com/Tencent/tdesign-mobile-react/issues) 反馈或扫码加入用户微信群。

<img src="https://raw.githubusercontent.com/Tencent/tdesign/main/packages/components/src/images/groups/react-group.png" width="200" />
<img src="https://raw.githubusercontent.com/Tencent/tdesign/main/packages/site-components/src/images/groups/react-group.png" width="200" />

# 开源协议

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Contributing is welcome. Read [guidelines for contributing](https://github.com/T

Create your [Github issues](https://github.com/Tencent/tdesign-mobile-react/issues) or scan the QR code below to join our user groups.

<img src="https://raw.githubusercontent.com/Tencent/tdesign/main/packages/components/src/images/groups/react-group.png" width="200" />
<img src="https://raw.githubusercontent.com/Tencent/tdesign/main/packages/site-components/src/images/groups/react-group.png" width="200" />

# License

Expand Down
4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
"site": "run-s site:build",
"site:build": "cd site && vite build",
"site:serve": "cd site && vite preview",
"site:intranet": "cd site && vite build --mode intranet",
"site:preview": "cd site && cross-env NODE_ENV=development vite build --mode preview",
"postsite:preview": "cp _site/index.html _site/404.html",
"lint": "eslint --ext .ts,.tsx ./ --max-warnings 0",
Expand Down Expand Up @@ -154,7 +153,6 @@
"rollup-plugin-styles": "^3.14.1",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.31.2",
"tdesign-icons-view": "^0.3.7",
"@tdesign/site-components": "^0.17.0",
"tdesign-theme-generator": "^1.1.8",
"typescript": "^5.8.3",
Expand All @@ -175,7 +173,7 @@
"lodash-es": "^4.17.21",
"react-transition-group": "^4.4.2",
"smoothscroll-polyfill": "^0.4.4",
"tdesign-icons-react": "^0.5.1",
"tdesign-icons-react": "^0.6.1",
"tinycolor2": "^1.6.0",
"validator": "^13.15.15"
},
Expand Down
1 change: 1 addition & 0 deletions site/.env.preview
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
NODE_ENV=development
42 changes: 21 additions & 21 deletions site/test-coverage.js
Original file line number Diff line number Diff line change
@@ -1,65 +1,65 @@
module.exports = {
actionSheet: { statements: '5.26%', branches: '0%', functions: '0%', lines: '5.35%' },
avatar: { statements: '100%', branches: '100%', functions: '100%', lines: '100%' },
backTop: { statements: '11.9%', branches: '0%', functions: '0%', lines: '12.82%' },
backTop: { statements: '100%', branches: '100%', functions: '100%', lines: '100%' },
badge: { statements: '100%', branches: '100%', functions: '100%', lines: '100%' },
button: { statements: '100%', branches: '100%', functions: '100%', lines: '100%' },
calendar: { statements: '98.45%', branches: '95.48%', functions: '100%', lines: '99.15%' },
cascader: { statements: '4.3%', branches: '0%', functions: '0%', lines: '4.59%' },
cell: { statements: '100%', branches: '77.77%', functions: '100%', lines: '100%' },
cascader: { statements: '100%', branches: '100%', functions: '100%', lines: '100%' },
cell: { statements: '100%', branches: '100%', functions: '100%', lines: '100%' },
checkbox: { statements: '99.12%', branches: '98.27%', functions: '100%', lines: '100%' },
collapse: { statements: '69.09%', branches: '36.66%', functions: '72.72%', lines: '72.54%' },
collapse: { statements: '100%', branches: '100%', functions: '100%', lines: '100%' },
colorPicker: { statements: '3.03%', branches: '0%', functions: '0%', lines: '3.03%' },
common: { statements: '82.75%', branches: '66.66%', functions: '83.33%', lines: '92%' },
configProvider: { statements: '54.54%', branches: '0%', functions: '0%', lines: '54.54%' },
countDown: { statements: '22.22%', branches: '0%', functions: '0%', lines: '25%' },
countDown: { statements: '100%', branches: '90%', functions: '100%', lines: '100%' },
dateTimePicker: { statements: '5.67%', branches: '0%', functions: '0%', lines: '6.06%' },
dialog: { statements: '4.3%', branches: '0%', functions: '0%', lines: '4.49%' },
divider: { statements: '100%', branches: '100%', functions: '100%', lines: '100%' },
drawer: { statements: '8.21%', branches: '0%', functions: '0%', lines: '9.23%' },
dropdownMenu: { statements: '12%', branches: '0%', functions: '0%', lines: '12.85%' },
drawer: { statements: '98.63%', branches: '100%', functions: '96.42%', lines: '100%' },
dropdownMenu: { statements: '100%', branches: '96.29%', functions: '100%', lines: '100%' },
empty: { statements: '100%', branches: '100%', functions: '100%', lines: '100%' },
fab: { statements: '5.4%', branches: '0%', functions: '0%', lines: '5.4%' },
footer: { statements: '100%', branches: '100%', functions: '100%', lines: '100%' },
form: { statements: '2.8%', branches: '0%', functions: '0%', lines: '2.96%' },
grid: { statements: '100%', branches: '100%', functions: '100%', lines: '100%' },
guide: { statements: '3.46%', branches: '0%', functions: '0%', lines: '3.77%' },
hooks: { statements: '43.65%', branches: '20.89%', functions: '43.75%', lines: '45%' },
image: { statements: '75%', branches: '75.75%', functions: '53.84%', lines: '73.8%' },
hooks: { statements: '69.04%', branches: '34.32%', functions: '71.87%', lines: '70%' },
image: { statements: '97.72%', branches: '100%', functions: '92.3%', lines: '97.61%' },
imageViewer: { statements: '8.47%', branches: '2.87%', functions: '0%', lines: '8.84%' },
indexes: { statements: '95.65%', branches: '69.81%', functions: '100%', lines: '96.94%' },
input: { statements: '3.57%', branches: '0%', functions: '0%', lines: '3.7%' },
layout: { statements: '93.93%', branches: '60%', functions: '100%', lines: '93.93%' },
layout: { statements: '100%', branches: '100%', functions: '100%', lines: '100%' },
link: { statements: '100%', branches: '100%', functions: '100%', lines: '100%' },
list: { statements: '8%', branches: '0%', functions: '0%', lines: '8.69%' },
loading: { statements: '98.43%', branches: '96.07%', functions: '100%', lines: '98.3%' },
locale: { statements: '55.55%', branches: '50%', functions: '66.66%', lines: '58.33%' },
message: { statements: '11.45%', branches: '0%', functions: '0%', lines: '11.82%' },
locale: { statements: '74.07%', branches: '62.5%', functions: '83.33%', lines: '75%' },
message: { statements: '100%', branches: '94.44%', functions: '100%', lines: '100%' },
navbar: { statements: '12.9%', branches: '0%', functions: '0%', lines: '13.79%' },
noticeBar: { statements: '6.38%', branches: '0%', functions: '0%', lines: '6.52%' },
overlay: { statements: '100%', branches: '100%', functions: '100%', lines: '100%' },
picker: { statements: '5.71%', branches: '0%', functions: '0%', lines: '6.28%' },
popover: { statements: '5%', branches: '0%', functions: '0%', lines: '5.55%' },
popover: { statements: '100%', branches: '96.55%', functions: '100%', lines: '100%' },
popup: { statements: '100%', branches: '100%', functions: '100%', lines: '100%' },
progress: { statements: '100%', branches: '97.36%', functions: '100%', lines: '100%' },
pullDownRefresh: { statements: '9.42%', branches: '2.73%', functions: '4.54%', lines: '9.23%' },
qrcode: { statements: '9.89%', branches: '0%', functions: '0%', lines: '10%' },
pullDownRefresh: { statements: '100%', branches: '98.43%', functions: '100%', lines: '100%' },
qrcode: { statements: '100%', branches: '92.5%', functions: '100%', lines: '100%' },
radio: { statements: '100%', branches: '100%', functions: '100%', lines: '100%' },
rate: { statements: '5.71%', branches: '0%', functions: '0%', lines: '5.71%' },
rate: { statements: '99.3%', branches: '98.98%', functions: '100%', lines: '99.3%' },
result: { statements: '100%', branches: '100%', functions: '100%', lines: '100%' },
search: { statements: '6.12%', branches: '0%', functions: '0%', lines: '6.25%' },
sideBar: { statements: '54.34%', branches: '0%', functions: '33.33%', lines: '58.53%' },
skeleton: { statements: '100%', branches: '95.83%', functions: '100%', lines: '100%' },
slider: { statements: '3.38%', branches: '0%', functions: '0%', lines: '3.46%' },
stepper: { statements: '83.01%', branches: '81.25%', functions: '90.9%', lines: '88%' },
steps: { statements: '100%', branches: '97.05%', functions: '100%', lines: '100%' },
sticky: { statements: '7.14%', branches: '0%', functions: '0%', lines: '7.27%' },
stepper: { statements: '100%', branches: '100%', functions: '100%', lines: '100%' },
steps: { statements: '100%', branches: '100%', functions: '100%', lines: '100%' },
sticky: { statements: '67.85%', branches: '30%', functions: '85.71%', lines: '69.09%' },
swipeCell: { statements: '4.42%', branches: '0%', functions: '0%', lines: '4.67%' },
swiper: { statements: '3.77%', branches: '0.9%', functions: '1.4%', lines: '3.89%' },
switch: { statements: '100%', branches: '100%', functions: '100%', lines: '100%' },
tabBar: { statements: '10%', branches: '0%', functions: '0%', lines: '10.81%' },
table: { statements: '6.09%', branches: '0%', functions: '0%', lines: '6.32%' },
tabs: { statements: '5.8%', branches: '0%', functions: '0%', lines: '6.33%' },
table: { statements: '100%', branches: '90%', functions: '100%', lines: '100%' },
tabs: { statements: '43.22%', branches: '18.75%', functions: '56%', lines: '45.07%' },
tag: { statements: '100%', branches: '96.87%', functions: '100%', lines: '100%' },
textarea: { statements: '98.64%', branches: '95%', functions: '93.33%', lines: '100%' },
toast: { statements: '98.73%', branches: '100%', functions: '94.11%', lines: '98.66%' },
Expand Down
8 changes: 5 additions & 3 deletions site/vite.config.js → site/vite.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ import { defineConfig } from 'vite';
import replace from '@rollup/plugin-replace';
import react from '@vitejs/plugin-react';
import { VitePWA } from 'vite-plugin-pwa';
import tdocPlugin from './plugin-tdoc';
import pwaConfig from './pwaConfig';

import changelog2Json from './web/plugins/changelog-to-json';
import tdocPlugin from './web/plugins/plugin-tdoc';

const publicPathMap = {
preview: '/',
intranet: '/mobile-react/',
production: 'https://static.tdesign.tencent.com/mobile-react/',
production: '/mobile-react/',
};

// Rollup 4+ 的 tree-shaking 策略调整, 这里是为了让样式在站点构建正常
Expand Down Expand Up @@ -63,6 +64,7 @@ export default ({ mode }) =>
plugins: [
react(),
tdocPlugin(),
changelog2Json(),
VitePWA(pwaConfig),
disableTreeShakingPlugin(['style/']),
replace({ __DATE__: new Date().toISOString() }),
Expand Down
1 change: 0 additions & 1 deletion site/web/main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import '@tdesign/site-components/lib/styles/prism-theme-dark.less';
import '@tdesign/site-components/lib/styles/prism-theme.less';
import '@tdesign/site-components/lib/styles/style.css';

import 'tdesign-icons-view';
import 'tdesign-theme-generator';

import App from './App';
Expand Down
32 changes: 32 additions & 0 deletions site/web/plugins/changelog-to-json/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { promises } from 'fs';
import path from 'path';

import generateChangelogJson from '../../../../src/_common/docs/plugins/changelog-to-json';

const outputPath = path.resolve(__dirname, '../../../../_site/changelog.json');
const changelogPath = path.resolve(__dirname, '../../../../CHANGELOG.md');

export default function changelog2Json() {
let config;
return {
name: 'changelog-to-json',
configResolved(resolvedConfig) {
config = resolvedConfig;
},
configureServer(server) {
// 开发模式时拦截请求
server.middlewares.use('/changelog.json', async (_, res) => {
const json = await generateChangelogJson(changelogPath, 'mobile');
res.setHeader('Content-Type', 'application/json');
res.end(JSON.stringify(json));
});
},
async closeBundle() {
// 生产构建时写入物理文件
if (config.env.PROD || config.env.MODE === 'preview') {
const json = await generateChangelogJson(changelogPath, 'mobile');
await promises.writeFile(outputPath, JSON.stringify(json));
}
},
};
}
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import path from 'path';
import matter from 'gray-matter';
import camelCase from 'camelcase';

import testCoverage from '../test-coverage';
import testCoverage from '../../../test-coverage';

import { transformSync } from '@babel/core';
import babelPresetReact from '@babel/preset-react';

export default function mdToReact(options) {
const mdSegment = customRender(options);
Expand Down Expand Up @@ -152,7 +153,7 @@ export default function mdToReact(options) {
generatorOpts: {
decoratorsBeforeExport: true,
},
presets: [require('@babel/preset-react')],
presets: [babelPresetReact],
});

return { code: result.code, map: result.map };
Expand Down Expand Up @@ -231,12 +232,13 @@ function customRender({ source, file, md }) {
}

// 移动端路由地址
// console.log('process.env', process.env);
const prefix = process.env.NODE_ENV === 'development' ? `/mobile.html` : `/mobile-react/mobile.html`;
mdSegment.mobileUrl = `${prefix}#/${componentName}`;

// 设计指南内容 不展示 design Tab 则不解析
if (pageData.isComponent && pageData.tdDocTabs.some((item) => item.tab === 'design')) {
const designDocPath = path.resolve(__dirname, `../../src/_common/docs/mobile/design/${componentName}.md`);
const designDocPath = path.resolve(__dirname, `../../../../src/_common/docs/mobile/design/${componentName}.md`);

if (fs.existsSync(designDocPath)) {
const designMd = fs.readFileSync(designDocPath, 'utf-8');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ export default {

// 统一换成 common 文档内容
if (fileName && source.includes(':: BASE_DOC ::')) {
const localeDocPath = path.resolve(__dirname, `../../src/_common/docs/mobile/api/${fileName}`);
const defaultDocPath = path.resolve(__dirname, `../../src/_common/docs/mobile/api/${componentName}.md`);
const localeDocPath = path.resolve(__dirname, `../../../../src/_common/docs/mobile/api/${fileName}`);
const defaultDocPath = path.resolve(__dirname, `../../../../src/_common/docs/mobile/api/${componentName}.md`);

let baseDoc = '';
if (fs.existsSync(localeDocPath)) {
Expand Down
4 changes: 3 additions & 1 deletion src/_util/dom.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { isFunction, isString } from 'lodash-es';

export const checkWindow = () => !!(typeof window !== 'undefined' && window.document && window.document.createElement);

// 用于判断是否可使用 dom
export const canUseDocument = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
export const canUseDocument = checkWindow();

/**
* 获取当前主题下的token色值
Expand Down
13 changes: 2 additions & 11 deletions src/back-top/Backtop.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,12 @@ import withNativeProps, { NativeProps } from '../_util/withNativeProps';
import useConfig from '../hooks/useConfig';
import { TdBackTopProps } from './type';
import { backTopDefaultProps } from './defaultProps';
import { canUseDocument } from '../_util/dom';
import { checkWindow } from '../_util/dom';

export type ThemeList = 'round' | 'half-round' | 'round-dark' | 'half-round-dark';

export type BackTopProps = TdBackTopProps & NativeProps;

export const defaultProps = {
fixed: true,
icon: 'backtop',
target: (() => window) as any,
text: '',
theme: 'round' as ThemeList,
visibilityHeight: 200,
};

const BackTop: React.FC<BackTopProps> = (props) => {
const { fixed, icon, target, text, theme, onToTop, visibilityHeight, container } = useDefaultProps(
props,
Expand All @@ -37,7 +28,7 @@ const BackTop: React.FC<BackTopProps> = (props) => {

const getBackTopDom = () => {
if (target) return target();
if (canUseDocument) return window.document.documentElement;
if (checkWindow()) return window.document.documentElement;
return null;
};
backTopDom.current = getBackTopDom();
Expand Down
Loading
Loading