Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop' into test/affix
Browse files Browse the repository at this point in the history
  • Loading branch information
RSS1102 committed Mar 3, 2025
2 parents 4507a75 + dd4c832 commit 381c0a8
Show file tree
Hide file tree
Showing 1,869 changed files with 9,292 additions and 5,499 deletions.
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ script/test/cypress
_site
temp*
static/
src/_common
packages/common
13 changes: 12 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module.exports = {
},
},
rules: {
"no-use-before-define": "off",
'no-use-before-define': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
Expand Down Expand Up @@ -72,5 +72,16 @@ module.exports = {
'func-names': 'off',
'consistent-return': 'off',
'default-case': 'off',
'no-restricted-imports': [
'error',
{
paths: [
{
name: 'lodash',
message: 'Please use lodash-es instead.',
},
],
},
],
},
};
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ cypress-coverage
instrumented
cy-report
.history
src/**/_example-js/
packages/components/**/_example-js/
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "src/_common"]
path = src/_common
[submodule "packages/common"]
path = packages/common
url = https://github.com/Tencent/tdesign-common.git
93 changes: 93 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,99 @@ toc: false
spline: explain
---

## 🌈 1.11.1 `2025-02-28`
### 🚀 Features
- `Layout`: 子组件 `Content` 新增 `content` API @liweijie0812 ([#3384](https://github.com/Tencent/tdesign-react/pull/3384))
### 🐞 Bug Fixes
- `reactRender`: fix `React19` `reactRender` error @HaixingOoO ([#3380](https://github.com/Tencent/tdesign-react/pull/3380))
- `table`: 修复虚拟滚动下的footer渲染问题 @huangchen1031 ([#3383](https://github.com/Tencent/tdesign-react/pull/3383))
- `fix`: 修复`1.11.0` cjs 产物的异常 @uyarn ([#3392](https://github.com/Tencent/tdesign-react/pull/3392))
### 📝 Documentation
- `ConfigProvider`: 增加 `globalConfig` API文档 @liweijie0812 ([#3384](https://github.com/Tencent/tdesign-react/pull/3384))

## 🌈 1.11.0 `2025-02-20`
### 🚀 Features
- `Cascader`: 新增支持在打开菜单时,自动滚动到首个已选项所在节点的能力 @uyarn ([#3357](https://github.com/Tencent/tdesign-react/pull/3357))
- `DatePicker`: 调整组件禁用日期`before``after`参数的逻辑,调整为禁用`before`定义之前和`after`定义之后的日期选择,此前有使用相关 API 请注意此改动 @lifeiFront ([#3362](https://github.com/Tencent/tdesign-react/pull/3362))
- `List`: 新增 `scroll` API,用于大数据量下支持开启虚拟滚动 @HaixingOoO ([#3363](https://github.com/Tencent/tdesign-react/pull/3363))
- `Menu`: 菜单新增折叠收起的动画效果 @hd10180 ([#3342](https://github.com/Tencent/tdesign-react/pull/3342))
- `TagInput`: 新增 `maxRows` API,用于设置最大展示行数 @Shabi-x ([#3293](https://github.com/Tencent/tdesign-react/pull/3293))

### 🐞 Bug Fixes
- `Card`: 修复 React 19 中的告警问题 @HaixingOoO ([#3369](https://github.com/Tencent/tdesign-react/pull/3369))
- `Cascader`: 修复多选动态加载使用异常的问题 @uyarn ([#3376](https://github.com/Tencent/tdesign-react/pull/3376))
- `CheckboxGroup`: 修复 `onChange``context` 参数缺少`option`的问题 @HaixingOoO ([#3349](https://github.com/Tencent/tdesign-react/pull/3349))
- `DatePicker`: 修复日期选择在负数时区的异常问题 @lifeiFront ([#3362](https://github.com/Tencent/tdesign-react/pull/3362))
- `Dropdown`: 修复点击事件回调context参数返回不符合文档描述的问题 @uyarn ([#3372](https://github.com/Tencent/tdesign-react/pull/3372))
- `Radio`: 修复 `RadioGroup` 在 React 19 版本下异常的问题 @HaixingOoO ([#3364](https://github.com/Tencent/tdesign-react/pull/3364))
- `Tabs`: 修复可滑动`Tabs`配合`action`使用的样式问题 @Wesley-0808([#3343](https://github.com/Tencent/tdesign-react/pull/3343))
- `Table`: 修复配合`Tabs`使用,切换 tab 时,Table 的 footer 不显示的问题 @wonkzhang ([#3370](https://github.com/Tencent/tdesign-react/pull/3370))
- `Textarea`: 修复使用 `autofocus` API 且 `value` 有值时,光标没有跟随内容末尾的问题 @HaixingOoO ([#3358](https://github.com/Tencent/tdesign-react/pull/3358))
- `Transfer`: 修复 `TransferItem` 无效的问题 @HaixingOoO ([#3339](https://github.com/Tencent/tdesign-react/pull/3339))


### 🚧 Others
- 调整组件依赖 `lodash` 依赖为`lodash-es` @zhangpaopao0609 ([#3345](https://github.com/Tencent/tdesign-react/pull/3345))

## 🌈 1.10.5 `2025-01-16`
### 🚀 Features
- `Radio`: `RadioGroup` 新增 `theme` API,用于决定使用 options 时渲染的子组件样式 @HaixingOoO ([#3303](https://github.com/Tencent/tdesign-react/pull/3303))
- `Upload`: 新增`imageProps` API,用于在上传图片场景下透传 `Image` 组件的相关属性 @HaixingOoO ([#3317](https://github.com/Tencent/tdesign-react/pull/3317))
- `AutoComplete`: 新增 `empty` API ,用于支持自定义空节点内容 @liweijie0812 ([#3319](https://github.com/Tencent/tdesign-react/pull/3319))
- `drawer`: `sizeDraggable`新增支持`SizeDragLimit`类型的功能实现 @huangchen1031 ([#3323](https://github.com/Tencent/tdesign-react/pull/3323))
- `Icon`: 新增`logo-alipay``logo-behance-filled`等图标,修改`logo-wecom`图标,移除不合理的`logo-wecom-filled`图标 @uyarn ([#3326](https://github.com/Tencent/tdesign-react/pull/3326))
### 🐞 Bug Fixes
- `Select`: 修复`onChange`回调 `context` 中的全部选项的值没有包含选项本身全部内容的问题 @uyarn ([#3305](https://github.com/Tencent/tdesign-react/pull/3305))
- `DateRangePicker`: 开始结束值同时存在的逻辑判断错误问题 @betavs ([#3301](https://github.com/Tencent/tdesign-react/pull/3301))
- `Notification`: 修复使用`attach`属性配置导致渲染节点异常的问题 @centuryPark ([#3306](https://github.com/Tencent/tdesign-react/pull/3306))
- `AutoComplete`: 修复当选项为空时显示效果异常的问题 @betavs ([#3316](https://github.com/Tencent/tdesign-react/pull/3316))
- `Menu`: 修复 `head-menu` 不渲染 `icon` 的问题 @HaixingOoO ([#3320](https://github.com/Tencent/tdesign-react/pull/3320))
- `Statistic`: 修复`decimalPlaces=0`时数值动画期间精度错误的问题 @huangchen1031 ([#3327](https://github.com/Tencent/tdesign-react/pull/3327))
- `ImageVewer`: 修复开启`closeOnOverlay`时,点击蒙层关闭存在闪烁情况的问题 @huangchen1031


## 🌈 1.10.4 `2024-12-25`
### 🚀 Features
- `Tree`: 支持 `onScroll` API,用于处理滚动事件回调 @HaixingOoO ([#3295](https://github.com/Tencent/tdesign-react/pull/3295))
- `Tooltip`: tooltip-lite 的`mouse` 模式下优化为完全跟随鼠标位置,更符合 API 描述 @moecasts ([#3267](https://github.com/Tencent/tdesign-react/pull/3267))
### 🐞 Bug Fixes
- `Select`: 修复全选默认返回值错误的问题 @uyarn ([#3298](https://github.com/Tencent/tdesign-react/pull/3298))
- `Upload`: 优化部分尺寸上传组件图片展示的样式问题 @huangchen1031 ([#3290](https://github.com/Tencent/tdesign-react/pull/3290))
### 📝 Documentation
- `Stackblitz`: 调整`Stackblitz`示例的启动方式,并修复部分示例无法使用`stackblitz``codesandbox`运行的问题 @uyarn ([#3297](https://github.com/Tencent/tdesign-react/pull/3297))



## 🌈 1.10.2 `2024-12-19`

### 🚀 Features

- `Alert`: 在 `maxLine >= message` 数组长度的情况下,不再展示 `展开更多/收起` 的按钮 @miownag ([#3281](https://github.com/Tencent/tdesign-react/pull/3281))
- `ConfigProvider`: `attach` 属性支持配置 `drawer` 组件,支持全局配置`drawer`的挂载位置 @HaixingOoO ([#3272](https://github.com/Tencent/tdesign-react/pull/3272))
- `DatePicker`: 多选模式支持周选择和年选择的场景 @HaixingOoO @uyarn ([#3264](https://github.com/Tencent/tdesign-react/pull/3264))
- `Form`: 新增`supportNumberKey` API,支持在`1.9.3`版本后不支持数字键值的场景使用,若不需要支持数字类型作为表单键值请关闭此 API @uyarn ([#3277](https://github.com/Tencent/tdesign-react/pull/3277))
- `Radio`: 新增 `Radio``RadioGroup``reaonly`属性的支持 @liweijie0812 ([#3280](https://github.com/Tencent/tdesign-react/pull/3280))
- `Tree`: 实例新增 `setIndeterminate` 方法,支持手动设置半选的功能 @uyarn ([#3261](https://github.com/Tencent/tdesign-react/pull/3261))
- `label`: `DatePicker``TimePicker``RangeInput`支持`label` API @liweijie0812 ([#3276](https://github.com/Tencent/tdesign-react/pull/3276))

### 🐞 Bug Fixes

- `DateRangePicker`: 修复日期区间选择器在跨年的场景下的展示异常问题 @huangchen1031 ([#3275](https://github.com/Tencent/tdesign-react/pull/3275))
- `Menu`: 优化菜单项点击事件的绑定问题避免边界触发异常的问题 @huangchen1031 ([#3241](https://github.com/Tencent/tdesign-react/pull/3241))
- `ImageViewer`: 修复不受控时,`visable`改变时都会触发`onClose`的问题 @HaixingOoO ([#3244](https://github.com/Tencent/tdesign-react/pull/3244))
- `CheckboxGroup`: 修复复选框组的子元素不是复选框导致的问题 @HaixingOoO ([#3253](https://github.com/Tencent/tdesign-react/pull/3253))
- `Form`: 修复`1.9.3`版本后,多级表单字段使用 `setFieldValues` 功能异常的问题 @l123wx ([#3279](https://github.com/Tencent/tdesign-react/pull/3279))
- `Form`: 修复当规则为中涉及 `0` 判断时,验证不生效的问题 @RSS1102 ([#3283](https://github.com/Tencent/tdesign-react/pull/3283))
- `Select`: 修复 `valueType``object`选中全选的展示异常及回调参数缺少的问题 @uyarn ([#3287](https://github.com/Tencent/tdesign-react/pull/3287))
- `SelectInput`: 修复没有 `label` 都会渲染节点导致垂直对齐的问题 @huangchen1031 ([#3278](https://github.com/Tencent/tdesign-react/pull/3278))
- `TextArea`: 优化 `TextArea` 初始化时 `autosize` 下计算高度的逻辑 @HaixingOoO ([#3286](https://github.com/Tencent/tdesign-react/pull/3286))

### 🚧 Others
- `Alert`: 优化测试用例代码类型和添加对于 `className``style` 的测试 @RSS1102 ([#3284](https://github.com/Tencent/tdesign-react/pull/3284))




## 🌈 1.10.1 `2024-11-28`
### 🚀 Features
- `DatePicker`: 新增`multiple` API,用于支持日期选择器多选功能,具体使用请参考示例 @HaixingOoO ([#3199](https://github.com/Tencent/tdesign-react/pull/3199))
Expand Down
16 changes: 11 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ npm run start

## 子仓库 tdesign-common

TDesign 的项目都会以子仓库的形式引入 `tdesign-common` 公共仓库,对应 `src/\_common` 文件夹,
TDesign 的项目都会以子仓库的形式引入 `tdesign-common` 公共仓库,对应 `packages/common` 文件夹,
公共仓库中包含

- 部分组件的一些框架无关的公共的工具函数
Expand All @@ -101,12 +101,18 @@ TDesign 的项目都会以子仓库的形式引入 `tdesign-common` 公共仓库
- 如开发部分提到的,初次克隆代码后需要初始化子仓库: `git submodule init && git submodule update`
- git submodule update 之后子仓库不指向任何分支,只是一个指向某一个提交的游离状态

### 子仓库开发
### 涉及子仓库的开发

子仓库组件分支从 `develop checkout` 示例:`feature/button`,提交代码时先进入子仓库完成提交,然在回到主仓库完成提交
1. Fork 并克隆子仓库 https://github.com/Tencent/tdesign-common
2. 新建分支,并进行开发
3. 提交子仓库的 PR,等待代码合入
4. 如果仅涉及子仓库改动,项目维护方会通过评论触发 CI,自动更新主仓库的子仓库指向;

- 先进入 `src/\_common` 文件夹,正常将样式修改添加提交
- 回到主仓库,此时应该会看到 `src/\_common` 文件夹是修改状态,按照正常步骤添加提交即可
如果需要配合子仓库改动,需要在步骤 3 完成后,在主仓库的开发过程中,将子仓库的指向改为合并后的主干的 commit id,主仓库代码开发完后正常提交发起 PR 即可

```bash
git submodule update --init --remote
```

### 组件库 UI

Expand Down
6 changes: 3 additions & 3 deletions DEVELOP_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ tdesign-react 包含 web-react 代码和一个子仓库,子仓库指向 [tdesi

## 公共子仓库 tdesign-common

本项目以子仓库的形式引入 tdesign-common 公共仓库,对应 src/\_common 文件夹
本项目以子仓库的形式引入 tdesign-common 公共仓库,对应 packages/common 文件夹
公共仓库中包含

- 一些公共的工具函数
Expand Down Expand Up @@ -50,7 +50,7 @@ UI 开发规范参考子仓库 README [子仓库 README](https://github.com/Tenc

### API 规范

[API](./src/_common/api.md)
[API](./packages/common/api.md)

### 前缀

Expand Down Expand Up @@ -157,7 +157,7 @@ npm run init button

### 组件 Demo 演示配置

为了保证与 vue 等其他仓库演示文档内容统一,目前将公共基础演示 demo 与说明归档在 `src/_common/docs/web/api/[组件].md` 中,其中需要各个技术栈的组件提供文档里面所要求的基础 demo 文件否则会编译警告。
为了保证与 vue 等其他仓库演示文档内容统一,目前将公共基础演示 demo 与说明归档在 `packages/common/docs/web/api/[组件].md` 中,其中需要各个技术栈的组件提供文档里面所要求的基础 demo 文件否则会编译警告。

例如 `tooltip` 组件则需要 `_expample` 文件夹中包含有 `arrow.jsx``noArrow.jsx` 文件

Expand Down
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "tdesign-react",
"purename": "tdesign",
"version": "1.10.1",
"version": "1.11.1",
"description": "TDesign Component for React",
"title": "tdesign-react",
"main": "lib/index.js",
Expand Down Expand Up @@ -42,12 +42,12 @@
"site:preview": "npm run build:jsx-demo && cd site && vite build --mode preview",
"postsite:preview": "cp _site/index.html _site/404.html",
"lint": "npm run lint:tsc && eslint --ext .ts,.tsx ./ --max-warnings 0",
"lint:fix": "eslint --ext .ts,.tsx ./src --ignore-pattern src/__tests__ --max-warnings 0 --fix",
"lint:fix": "eslint --ext .ts,.tsx ./packages/components --ignore-pattern packages/components/__tests__ --max-warnings 0 --fix",
"lint:tsc": "tsc -p ./tsconfig.dev.json ",
"generate:usage": "node script/generate-usage/index.js",
"generate:coverage-badge": "npm run test:coverage && node script/generate-coverage.js",
"generate:jsx-demo": "npx babel src/**/_example --extensions '.tsx' --config-file ./babel.config.demo.js --relative --out-dir ../_example-js --out-file-extension=.jsx",
"format:jsx-demo": "npx eslint src/**/_example-js/*.jsx --fix && npx prettier --write src/**/_example-js/*.jsx",
"generate:jsx-demo": "npx babel packages/components/**/_example --extensions '.tsx' --config-file ./babel.config.demo.js --relative --out-dir ../_example-js --out-file-extension=.jsx",
"format:jsx-demo": "npx eslint packages/components/**/_example-js/*.jsx --fix && npx prettier --write packages/components/**/_example-js/*.jsx",
"test": "vitest run && npm run test:snap",
"test:ui": "vitest --ui",
"test:snap": "cross-env NODE_ENV=test-snap vitest run",
Expand Down Expand Up @@ -121,7 +121,7 @@
"@testing-library/user-event": "^14.4.3",
"@types/estree": "1.0.6",
"@types/hoist-non-react-statics": "^3.3.1",
"@types/lodash": "4.17.13",
"@types/lodash-es": "^4.17.12",
"@types/node": "^22.7.0",
"@types/raf": "^3.4.0",
"@types/react": "~18.2.0",
Expand Down Expand Up @@ -185,7 +185,7 @@
"rollup-plugin-typescript2": "^0.31.2",
"semver": "^7.6.3",
"start-server-and-test": "^1.14.0",
"tdesign-icons-view": "^0.3.0",
"tdesign-icons-view": "^0.3.4",
"tdesign-publish-cli": "^0.0.12",
"tdesign-site-components": "^0.15.3",
"tdesign-theme-generator": "^1.0.0",
Expand All @@ -200,22 +200,22 @@
"workbox-precaching": "^7.0.0"
},
"dependencies": {
"@babel/runtime": "~7.24.7",
"@babel/runtime": "~7.26.7",
"@popperjs/core": "~2.11.2",
"@types/sortablejs": "^1.10.7",
"@types/tinycolor2": "^1.4.3",
"@types/validator": "^13.1.3",
"classnames": "~2.5.1",
"dayjs": "1.11.10",
"hoist-non-react-statics": "~3.3.2",
"lodash": "~4.17.15",
"lodash-es": "^4.17.21",
"mitt": "^3.0.0",
"raf": "~3.4.1",
"react-is": "^18.2.0",
"react-popper": "~2.3.0",
"react-transition-group": "~4.4.1",
"sortablejs": "^1.15.0",
"tdesign-icons-react": "^0.3.4",
"tdesign-icons-react": "^0.4.3",
"tinycolor2": "^1.4.2",
"tslib": "~2.3.1",
"validator": "~13.7.0"
Expand Down
1 change: 1 addition & 0 deletions packages/common
Submodule common added at f15c0c
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/_util/dom.ts → packages/components/_util/dom.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import raf from 'raf';
import isString from 'lodash/isString';
import { isString } from 'lodash-es';
import { easeInOutCubic, EasingFunction } from './easing';
import { ScrollContainer, ScrollContainerElement } from '../common';

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import camelCase from 'lodash/camelCase';
import { camelCase } from 'lodash-es';

export function omit(obj: object, fields: string[]): object {
const shallowCopy = {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { ReactElement, ReactNode } from 'react';
import isFunction from 'lodash/isFunction';
import { isFunction } from 'lodash-es';
import { TNode } from '../common';
import log from '../_common/js/log';
import log from '../../common/js/log';

// 解析 TNode 数据结构
export default function parseTNode(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// @ts-ignore
import type * as React from 'react';
import * as ReactDOM from 'react-dom';
import { createRoot as createRootClient } from 'react-dom/client';
import type { Root } from 'react-dom/client';

// Let compiler not to search module usage
Expand All @@ -16,13 +17,16 @@ const fullClone = {

type CreateRoot = (container: ContainerType) => Root;

// @ts-ignore
const { version, render: reactRender, unmountComponentAtNode } = fullClone;

let createRoot: CreateRoot;
try {
const mainVersion = Number((version || '').split('.')[0]);
if (mainVersion >= 18) {
if (mainVersion >= 18 && mainVersion < 19) {
({ createRoot } = fullClone);
} else if (mainVersion >= 19) {
createRoot = createRootClient;
}
} catch (e) {
// Do nothing;
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useEffect, forwardRef, useCallback, useImperativeHandle, useRef } from 'react';
import isFunction from 'lodash/isFunction';
import { isFunction } from 'lodash-es';
import { StyledProps, ScrollContainerElement } from '../common';
import { TdAffixProps } from './type';
import { getScrollContainer } from '../_util/dom';
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ name | type | default | description | required
-- | -- | -- | -- | --
className | String | - | 类名 | N
style | Object | - | 样式,Typescript:`React.CSSProperties` | N
children | TNode | - | Typescript:`string \| TNode`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
container | String / Function | () => (() => window) | Typescript:`ScrollContainer`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
content | TNode | - | Typescript:`string \| TNode`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
children | TNode | - | Typescript:`string \| TNode`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/packages/components/common.ts) | N
container | String / Function | () => (() => window) | Typescript:`ScrollContainer`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/packages/components/common.ts) | N
content | TNode | - | Typescript:`string \| TNode`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/packages/components/common.ts) | N
offsetBottom | Number | 0 | When the distance from the bottom of the container reaches the specified distance, the trigger is fixed | N
offsetTop | Number | 0 | When the distance from the top of the container reaches the specified distance, the trigger is fixed | N
zIndex | Number | - | \- | N
Expand Down
Loading

0 comments on commit 381c0a8

Please sign in to comment.