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

feat(checkbox): support title API #3207

Merged
merged 2 commits into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions src/checkbox/checkbox.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ indeterminate | Boolean | false | \- | N
label | TNode | - | Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
name | String | - | \- | N
readonly | Boolean | false | \- | N
title | String | - | html attribute | N
value | String / Number / Boolean | - | value of checkbox。Typescript:`string \| number \| boolean` | N
onChange | Function | | Typescript:`(checked: boolean, context: { e: ChangeEvent }) => void`<br/> | N
onClick | Function | | Typescript:`(context: { e: MouseEvent }) => void`<br/>trigger on click | N
Expand Down
1 change: 1 addition & 0 deletions src/checkbox/checkbox.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ indeterminate | Boolean | false | 是否为半选 | N
label | TNode | - | 主文案。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
name | String | - | HTML 元素原生属性 | N
readonly | Boolean | false | 只读状态 | N
title | String | - | HTML 原生属性 | N
value | String / Number / Boolean | - | 多选框的值。TS 类型:`string \| number \| boolean` | N
onChange | Function | | TS 类型:`(checked: boolean, context: { e: ChangeEvent }) => void`<br/>值变化时触发 | N
onClick | Function | | TS 类型:`(context: { e: MouseEvent }) => void`<br/>点击时触发,一般用于外层阻止冒泡场景 | N
Expand Down
5 changes: 5 additions & 0 deletions src/checkbox/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ export interface TdCheckboxProps {
* @default false
*/
readonly?: boolean;
/**
* HTML 原生属性
* @default ''
*/
title?: string;
/**
* 多选框的值
*/
Expand Down
2 changes: 1 addition & 1 deletion src/table/_example/select-multiple.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const columns: TableProps['columns'] = [

// 禁用行选中方式二:使用 checkProps 禁用行(示例代码有效,勿删)
// 这种方式禁用行选中,行文本不会变灰
checkProps: ({ rowIndex }) => ({ disabled: rowIndex % 2 !== 0 }),
checkProps: ({ rowIndex }) => ({ disabled: rowIndex % 2 !== 0, title: rowIndex % 2 !== 0 ? '不可选' : null }),
width: 50,
},
{ colKey: 'applicant', title: '申请人', width: '100' },
Expand Down
4 changes: 3 additions & 1 deletion test/snap/__snapshots__/csr.test.jsx.snap

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion test/snap/__snapshots__/ssr.test.jsx.snap

Large diffs are not rendered by default.

Loading