Skip to content

Commit 0cc14c4

Browse files
authored
feat(Tree): allow checkProps to be a function (#600)
1 parent 60e86b3 commit 0cc14c4

File tree

13 files changed

+18
-24
lines changed

13 files changed

+18
-24
lines changed

db/TDesign.db

0 Bytes
Binary file not shown.

packages/products/tdesign-react/packages/components/tree/tree.en-US.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ activeMultiple | Boolean | false | \- | N
1313
actived | Array | - | Typescript:`Array<TreeNodeValue>` | N
1414
allowDrop | Function | - | Determine whether the node can execute the drop operation。Typescript:`(context: { e: DragEvent; dragNode: TreeNodeModel<T>; dropNode: TreeNodeModel<T>; dropPosition: number; }) => boolean` | N
1515
allowFoldNodeOnFilter | Boolean | false | \- | N
16-
checkProps | Object | - | Typescript:`CheckboxProps`[Checkbox API Documents](./checkbox?tab=api)[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/packages/components/tree/type.ts) | N
16+
checkProps | Object / Function | - | Typescript:`CheckboxProps \| ((node: TreeNodeModel<T>) => CheckboxProps)`[Checkbox API Documents](./checkbox?tab=api)[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/packages/components/tree/type.ts) | N
1717
checkStrictly | Boolean | false | \- | N
1818
checkable | Boolean | false | \- | N
1919
data | Array | [] | Typescript:`Array<T>` | N

packages/products/tdesign-react/packages/components/tree/tree.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ activeMultiple | Boolean | false | 是否允许多个节点同时高亮 | N
1313
actived | Array | - | 高亮的节点值。TS 类型:`Array<TreeNodeValue>` | N
1414
allowDrop | Function | - | 判断节点是否可以执行 drop 操作,泛型 `T` 表示树节点 TS 类型。TS 类型:`(context: { e: DragEvent; dragNode: TreeNodeModel<T>; dropNode: TreeNodeModel<T>; dropPosition: number; }) => boolean` | N
1515
allowFoldNodeOnFilter | Boolean | false | 是否允许在过滤时节点折叠节点 | N
16-
checkProps | Object | - | 透传属性到 checkbox 组件。参考 checkbox 组件 API。TS 类型:`CheckboxProps`[Checkbox API Documents](./checkbox?tab=api)[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/packages/components/tree/type.ts) | N
16+
checkProps | Object / Function | - | 透传属性到 checkbox 组件。参考 checkbox 组件 API。TS 类型:`CheckboxProps \| ((node: TreeNodeModel<T>) => CheckboxProps)`[Checkbox API Documents](./checkbox?tab=api)[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/packages/components/tree/type.ts) | N
1717
checkStrictly | Boolean | false | 父子节点选中状态不再关联,可各自选中或取消 | N
1818
checkable | Boolean | false | 隐藏节点复选框 | N
1919
data | Array | [] | 树数据,泛型 `T` 表示树节点 TS 类型。TS 类型:`Array<T>` | N

packages/products/tdesign-react/packages/components/tree/type.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export interface TdTreeProps<T extends TreeOptionData = TreeOptionData> {
4444
/**
4545
* 透传属性到 checkbox 组件。参考 checkbox 组件 API
4646
*/
47-
checkProps?: CheckboxProps;
47+
checkProps?: CheckboxProps | ((node: TreeNodeModel<T>) => CheckboxProps);
4848
/**
4949
* 父子节点选中状态不再关联,可各自选中或取消
5050
* @default false

packages/products/tdesign-vue-next/packages/components/tree/props.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export default {
2929
allowFoldNodeOnFilter: Boolean,
3030
/** 透传属性到 checkbox 组件。参考 checkbox 组件 API */
3131
checkProps: {
32-
type: Object as PropType<TdTreeProps['checkProps']>,
32+
type: [Object, Function] as PropType<TdTreeProps['checkProps']>,
3333
},
3434
/** 父子节点选中状态不再关联,可各自选中或取消 */
3535
checkStrictly: Boolean,

packages/products/tdesign-vue-next/packages/components/tree/tree.en-US.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ activeMultiple | Boolean | false | \- | N
1111
actived | Array | - | `v-model:actived` is supported。Typescript:`Array<TreeNodeValue>` | N
1212
allowDrop | Function | - | Determine whether the node can execute the drop operation。Typescript:`(context: { e: DragEvent; dragNode: TreeNodeModel<T>; dropNode: TreeNodeModel<T>; dropPosition: number; }) => boolean` | N
1313
allowFoldNodeOnFilter | Boolean | false | \- | N
14-
checkProps | Object | - | Typescript:`CheckboxProps`[Checkbox API Documents](./checkbox?tab=api)[see more ts definition](https://github.com/Tencent/tdesign-vue-next/blob/develop/packages/components/tree/type.ts) | N
14+
checkProps | Object / Function | - | Typescript:`CheckboxProps \| ((node: TreeNodeModel<T>) => CheckboxProps)`[Checkbox API Documents](./checkbox?tab=api)[see more ts definition](https://github.com/Tencent/tdesign-vue-next/blob/develop/packages/components/tree/type.ts) | N
1515
checkStrictly | Boolean | false | \- | N
1616
checkable | Boolean | false | \- | N
1717
data | Array | [] | Typescript:`Array<T>` | N

packages/products/tdesign-vue-next/packages/components/tree/tree.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ activeMultiple | Boolean | false | 是否允许多个节点同时高亮 | N
1111
actived | Array | - | 高亮的节点值。支持语法糖 `v-model:actived`。TS 类型:`Array<TreeNodeValue>` | N
1212
allowDrop | Function | - | 判断节点是否可以执行 drop 操作,泛型 `T` 表示树节点 TS 类型。TS 类型:`(context: { e: DragEvent; dragNode: TreeNodeModel<T>; dropNode: TreeNodeModel<T>; dropPosition: number; }) => boolean` | N
1313
allowFoldNodeOnFilter | Boolean | false | 是否允许在过滤时节点折叠节点 | N
14-
checkProps | Object | - | 透传属性到 checkbox 组件。参考 checkbox 组件 API。TS 类型:`CheckboxProps`[Checkbox API Documents](./checkbox?tab=api)[详细类型定义](https://github.com/Tencent/tdesign-vue-next/blob/develop/packages/components/tree/type.ts) | N
14+
checkProps | Object / Function | - | 透传属性到 checkbox 组件。参考 checkbox 组件 API。TS 类型:`CheckboxProps \| ((node: TreeNodeModel<T>) => CheckboxProps)`[Checkbox API Documents](./checkbox?tab=api)[详细类型定义](https://github.com/Tencent/tdesign-vue-next/blob/develop/packages/components/tree/type.ts) | N
1515
checkStrictly | Boolean | false | 父子节点选中状态不再关联,可各自选中或取消 | N
1616
checkable | Boolean | false | 隐藏节点复选框 | N
1717
data | Array | [] | 树数据,泛型 `T` 表示树节点 TS 类型。TS 类型:`Array<T>` | N

packages/products/tdesign-vue-next/packages/components/tree/type.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export interface TdTreeProps<T extends TreeOptionData = TreeOptionData> {
4343
/**
4444
* 透传属性到 checkbox 组件。参考 checkbox 组件 API
4545
*/
46-
checkProps?: CheckboxProps;
46+
checkProps?: CheckboxProps | ((node: TreeNodeModel<T>) => CheckboxProps);
4747
/**
4848
* 父子节点选中状态不再关联,可各自选中或取消
4949
* @default false

packages/products/tdesign-vue/src/tree/props.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export default {
2828
allowFoldNodeOnFilter: Boolean,
2929
/** 透传属性到 checkbox 组件。参考 checkbox 组件 API */
3030
checkProps: {
31-
type: Object as PropType<TdTreeProps['checkProps']>,
31+
type: [Object, Function] as PropType<TdTreeProps['checkProps']>,
3232
},
3333
/** 父子节点选中状态不再关联,可各自选中或取消 */
3434
checkStrictly: Boolean,

packages/products/tdesign-vue/src/tree/tree.en-US.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ activeMultiple | Boolean | false | \- | N
1111
actived | Array | - | `.sync` is supported。Typescript:`Array<TreeNodeValue>` | N
1212
allowDrop | Function | - | Determine whether the node can execute the drop operation。Typescript:`(context: { e: DragEvent; dragNode: TreeNodeModel<T>; dropNode: TreeNodeModel<T>; dropPosition: number; }) => boolean` | N
1313
allowFoldNodeOnFilter | Boolean | false | \- | N
14-
checkProps | Object | - | Typescript:`CheckboxProps`[Checkbox API Documents](./checkbox?tab=api)[see more ts definition](https://github.com/Tencent/tdesign-vue/tree/develop/src/tree/type.ts) | N
14+
checkProps | Object / Function | - | Typescript:`CheckboxProps \| ((node: TreeNodeModel<T>) => CheckboxProps)`[Checkbox API Documents](./checkbox?tab=api)[see more ts definition](https://github.com/Tencent/tdesign-vue/tree/develop/src/tree/type.ts) | N
1515
checkStrictly | Boolean | false | \- | N
1616
checkable | Boolean | false | \- | N
1717
data | Array | [] | Typescript:`Array<T>` | N

0 commit comments

Comments
 (0)