From 2a7e8fe4e2f8d5673817b4469bf913fffd365648 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 2 May 2024 21:40:14 +0800 Subject: [PATCH 01/20] chore(deps): bump classnames from 2.3.3 to 2.5.1 (#2876) Bumps [classnames](https://github.com/JedWatson/classnames) from 2.3.3 to 2.5.1. - [Changelog](https://github.com/JedWatson/classnames/blob/main/HISTORY.md) - [Commits](https://github.com/JedWatson/classnames/compare/v2.3.3...v2.5.1) --- updated-dependencies: - dependency-name: classnames dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 30afc73dc6..976752b65a 100644 --- a/package.json +++ b/package.json @@ -202,7 +202,7 @@ "@types/sortablejs": "^1.10.7", "@types/tinycolor2": "^1.4.3", "@types/validator": "^13.1.3", - "classnames": "~2.3.1", + "classnames": "~2.5.1", "dayjs": "1.11.10", "hoist-non-react-statics": "~3.3.2", "lodash": "~4.17.15", From e0f49a958f69e4b81065366947b66dcd4f188e7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?w=C5=AB=20y=C4=81ng?= Date: Sat, 4 May 2024 18:52:22 +0800 Subject: [PATCH 02/20] chore: fix docs (#2877) --- src/checkbox/checkbox.md | 2 +- src/checkbox/type.ts | 2 +- src/radio/radio.md | 2 +- src/radio/type.ts | 2 +- src/select/hooks/usePanelVirtualScroll.ts | 2 +- src/table/BaseTable.tsx | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/checkbox/checkbox.md b/src/checkbox/checkbox.md index 1b106f3964..1393819bab 100644 --- a/src/checkbox/checkbox.md +++ b/src/checkbox/checkbox.md @@ -23,7 +23,7 @@ name | String | - | HTML 元素原生属性 | N readonly | Boolean | false | 只读状态 | N value | String / Number / Boolean | - | 多选框的值。TS 类型:`string \| number \| boolean` | N onChange | Function | | TS 类型:`(checked: boolean, context: { e: ChangeEvent }) => void`
值变化时触发 | N -onClick | Function | | TS 类型:`(context: { e: MouseEvent }) => void`
点击时出发,一般用于外层阻止冒泡场景 | N +onClick | Function | | TS 类型:`(context: { e: MouseEvent }) => void`
点击时触发,一般用于外层阻止冒泡场景 | N ### CheckboxGroup Props diff --git a/src/checkbox/type.ts b/src/checkbox/type.ts index 649b98762a..418904b76a 100644 --- a/src/checkbox/type.ts +++ b/src/checkbox/type.ts @@ -59,7 +59,7 @@ export interface TdCheckboxProps { */ onChange?: (checked: boolean, context: { e: ChangeEvent }) => void; /** - * 点击时出发,一般用于外层阻止冒泡场景 + * 点击时触发,一般用于外层阻止冒泡场景 */ onClick?: (context: { e: MouseEvent }) => void; } diff --git a/src/radio/radio.md b/src/radio/radio.md index afafd20ee8..3f7688bac3 100644 --- a/src/radio/radio.md +++ b/src/radio/radio.md @@ -16,7 +16,7 @@ label | TNode | - | 主文案。TS 类型:`string \| TNode`。[通用类型定 name | String | - | HTML 元素原生属性 | N value | String / Number / Boolean | undefined | 单选按钮的值。TS 类型:`T` | N onChange | Function | | TS 类型:`(checked: boolean, context: { e: ChangeEvent }) => void`
选中状态变化时触发 | N -onClick | Function | | TS 类型:`(context: { e: MouseEvent }) => void`
点击时出发,一般用于外层阻止冒泡场景 | N +onClick | Function | | TS 类型:`(context: { e: MouseEvent }) => void`
点击时触发,一般用于外层阻止冒泡场景 | N ### RadioGroup Props diff --git a/src/radio/type.ts b/src/radio/type.ts index 01de0bad1d..4ab9f830a5 100644 --- a/src/radio/type.ts +++ b/src/radio/type.ts @@ -49,7 +49,7 @@ export interface TdRadioProps { */ onChange?: (checked: boolean, context: { e: ChangeEvent }) => void; /** - * 点击时出发,一般用于外层阻止冒泡场景 + * 点击触发,一般用于外层阻止冒泡场景 */ onClick?: (context: { e: MouseEvent }) => void; } diff --git a/src/select/hooks/usePanelVirtualScroll.ts b/src/select/hooks/usePanelVirtualScroll.ts index 3482fe6712..e349e1931e 100644 --- a/src/select/hooks/usePanelVirtualScroll.ts +++ b/src/select/hooks/usePanelVirtualScroll.ts @@ -54,7 +54,7 @@ const usePanelVirtualScroll = ({ popupContentRef, scroll, options, size }: Panel } const target = e.target as HTMLElement; const top = target.scrollTop; - // 排除横向滚动出发的纵向虚拟滚动计算 + // 排除横向滚动触发的纵向虚拟滚动计算 if (Math.abs(lastScrollY - top) > 5) { handleVirtualScroll(); // eslint-disable-next-line react-hooks/exhaustive-deps diff --git a/src/table/BaseTable.tsx b/src/table/BaseTable.tsx index 59ce4e0de2..712749f988 100644 --- a/src/table/BaseTable.tsx +++ b/src/table/BaseTable.tsx @@ -207,7 +207,7 @@ const BaseTable = forwardRef((originalProps, ref) const onInnerVirtualScroll = (e: WheelEvent) => { const target = e.target as HTMLElement; const top = target.scrollTop; - // 排除横向滚动出发的纵向虚拟滚动计算 + // 排除横向滚动触发的纵向虚拟滚动计算 if (lastScrollY !== top) { virtualConfig.isVirtualScroll && virtualConfig.handleScroll(); } else { From e0f807006603ef4e70f1061bd584f85a1b1506a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?w=C5=AB=20y=C4=81ng?= Date: Mon, 6 May 2024 17:42:21 +0800 Subject: [PATCH 03/20] feat(input): add borderless mode (#2878) --- src/_common | 2 +- src/input/Input.tsx | 2 + src/input/_example/borderless.jsx | 12 ++ src/input/defaultProps.ts | 1 + src/input/input.en-US.md | 1 + src/input/input.md | 1 + src/input/type.ts | 5 + test/snap/__snapshots__/csr.test.jsx.snap | 155 ++++++++++++++++++++++ test/snap/__snapshots__/ssr.test.jsx.snap | 2 + 9 files changed, 180 insertions(+), 1 deletion(-) create mode 100644 src/input/_example/borderless.jsx diff --git a/src/_common b/src/_common index a8d0cac78f..b010e4cd35 160000 --- a/src/_common +++ b/src/_common @@ -1 +1 @@ -Subproject commit a8d0cac78f86ad80746b07b9cfd3b152b101253c +Subproject commit b010e4cd357863cf0ae8f74d8bb45b499154e542 diff --git a/src/input/Input.tsx b/src/input/Input.tsx index f3d5f367ae..83fd5dd943 100644 --- a/src/input/Input.tsx +++ b/src/input/Input.tsx @@ -56,6 +56,7 @@ const Input = forwardRefWithStatics( const { type, autoWidth, + borderless, placeholder = t(local.placeholder), disabled, status, @@ -248,6 +249,7 @@ const Input = forwardRefWithStatics( [`${classPrefix}-is-${tStatus}`]: tStatus && tStatus !== 'default', [`${classPrefix}-input--prefix`]: prefixIcon || labelContent, [`${classPrefix}-input--suffix`]: suffixIconContent || suffixContent, + [`${classPrefix}-input--borderless`]: borderless, [`${classPrefix}-input--focused`]: isFocused, })} onMouseEnter={handleMouseEnter} diff --git a/src/input/_example/borderless.jsx b/src/input/_example/borderless.jsx new file mode 100644 index 0000000000..f119c0b4b1 --- /dev/null +++ b/src/input/_example/borderless.jsx @@ -0,0 +1,12 @@ +import React from 'react'; +import { Input, Space } from 'tdesign-react'; +import { SearchIcon } from 'tdesign-icons-react'; + +export default function BorderlessInputExample() { + return ( + + + + + ); +} diff --git a/src/input/defaultProps.ts b/src/input/defaultProps.ts index 98bbbbe035..feae431aba 100644 --- a/src/input/defaultProps.ts +++ b/src/input/defaultProps.ts @@ -10,6 +10,7 @@ export const inputDefaultProps: TdInputProps = { autoWidth: false, autocomplete: undefined, autofocus: false, + borderless: false, clearable: false, placeholder: undefined, readonly: false, diff --git a/src/input/input.en-US.md b/src/input/input.en-US.md index 89e29ccfb9..f6f2424ab5 100644 --- a/src/input/input.en-US.md +++ b/src/input/input.en-US.md @@ -12,6 +12,7 @@ allowInputOverMax | Boolean | false | \- | N autoWidth | Boolean | false | \- | N autocomplete | String | undefined | \- | N autofocus | Boolean | false | \- | N +borderless | Boolean | false | input without border | N clearable | Boolean | false | \- | N disabled | Boolean | - | \- | N format | Function | - | Typescript:`InputFormatType` `type InputFormatType = (value: InputValue) => string`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/input/type.ts) | N diff --git a/src/input/input.md b/src/input/input.md index 6f1cb9fd23..a4a719bdcc 100644 --- a/src/input/input.md +++ b/src/input/input.md @@ -12,6 +12,7 @@ allowInputOverMax | Boolean | false | 超出 `maxlength` 或 `maxcharacter` 之 autoWidth | Boolean | false | 宽度随内容自适应 | N autocomplete | String | undefined | 是否开启自动填充功能,HTML5 原生属性,[点击查看详情](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete) | N autofocus | Boolean | false | 自动聚焦 | N +borderless | Boolean | false | 无边框模式 | N clearable | Boolean | false | 是否可清空 | N disabled | Boolean | - | 是否禁用输入框 | N format | Function | - | 指定输入框展示值的格式。TS 类型:`InputFormatType` `type InputFormatType = (value: InputValue) => string`。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/input/type.ts) | N diff --git a/src/input/type.ts b/src/input/type.ts index a7f698fc0d..0402ced4f6 100644 --- a/src/input/type.ts +++ b/src/input/type.ts @@ -32,6 +32,11 @@ export interface TdInputProps { * @default false */ autofocus?: boolean; + /** + * 无边框模式 + * @default false + */ + borderless?: boolean; /** * 是否可清空 * @default false diff --git a/test/snap/__snapshots__/csr.test.jsx.snap b/test/snap/__snapshots__/csr.test.jsx.snap index cfc27de024..b9327a0250 100644 --- a/test/snap/__snapshots__/csr.test.jsx.snap +++ b/test/snap/__snapshots__/csr.test.jsx.snap @@ -119797,6 +119797,159 @@ exports[`csr snapshot test > csr test src/input/_example/base.jsx 1`] = ` } `; +exports[`csr snapshot test > csr test src/input/_example/borderless.jsx 1`] = ` +{ + "asFragment": [Function], + "baseElement": +