Skip to content

Commit

Permalink
feat: tree-select add keys api
Browse files Browse the repository at this point in the history
  • Loading branch information
PengYYYYY committed Aug 14, 2023
1 parent a12cf44 commit 0021db5
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/tree-select/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ export default {
defaultInputValue: {
type: [String, Number] as PropType<TdTreeSelectProps['defaultInputValue']>,
},
/** 用来定义 `value / label / children / disabled` 在 `data` 数据中对应的字段别名,示例:`{ value: 'key', label 'name', children: 'list' }` */
keys: {
type: Object as PropType<TdTreeSelectProps['keys']>,
},
/** 是否正在加载数据 */
loading: Boolean,
/** 远程加载时显示的文字,支持自定义。如加上超链接 */
Expand Down
1 change: 1 addition & 0 deletions src/tree-select/tree-select.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ filterable | Boolean | false | \- | N
inputProps | Object | - | Typescript:`InputProps`[Input API Documents](./input?tab=api)[see more ts definition](https://github.com/Tencent/tdesign-vue-next/tree/develop/src/tree-select/type.ts) | N
inputValue | String / Number | - | input value。`v-model:inputValue` is supported。Typescript:`InputValue`[Input API Documents](./input?tab=api)[see more ts definition](https://github.com/Tencent/tdesign-vue-next/tree/develop/src/tree-select/type.ts) | N
defaultInputValue | String / Number | - | input value。uncontrolled property。Typescript:`InputValue`[Input API Documents](./input?tab=api)[see more ts definition](https://github.com/Tencent/tdesign-vue-next/tree/develop/src/tree-select/type.ts) | N
keys | Object | - | Typescript:`TreeKeysType`[see more ts definition](https://github.com/Tencent/tdesign-vue-next/blob/develop/src/common.ts) | N
loading | Boolean | false | \- | N
loadingText | String / Slot / Function | - | Typescript:`string \| TNode`[see more ts definition](https://github.com/Tencent/tdesign-vue-next/blob/develop/src/common.ts) | N
max | Number | 0 | \- | N
Expand Down
2 changes: 2 additions & 0 deletions src/tree-select/tree-select.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ filterable | Boolean | false | 是否可搜索 | N
inputProps | Object | - | 透传给 输入框 Input 组件的全部属性。TS 类型:`InputProps`[Input API Documents](./input?tab=api)[详细类型定义](https://github.com/Tencent/tdesign-vue-next/tree/develop/src/tree-select/type.ts) | N
inputValue | String / Number | - | 输入框的值。支持语法糖 `v-model:inputValue`。TS 类型:`InputValue`[Input API Documents](./input?tab=api)[详细类型定义](https://github.com/Tencent/tdesign-vue-next/tree/develop/src/tree-select/type.ts) | N
defaultInputValue | String / Number | - | 输入框的值。非受控属性。TS 类型:`InputValue`[Input API Documents](./input?tab=api)[详细类型定义](https://github.com/Tencent/tdesign-vue-next/tree/develop/src/tree-select/type.ts) | N
keys | Object | - | 用来定义 `value / label / children / disabled``data` 数据中对应的字段别名,示例:`{ value: 'key', label 'name', children: 'list' }`。TS 类型:`TreeKeysType`[通用类型定义](https://github.com/Tencent/tdesign-vue-next/blob/develop/src/common.ts) | N
label | String / Slot / Function | - | 左侧文本。TS 类型:`string \| TNode`[通用类型定义](https://github.com/Tencent/tdesign-vue-next/blob/develop/src/common.ts) | N
loading | Boolean | false | 是否正在加载数据 | N
loadingText | String / Slot / Function | - | 远程加载时显示的文字,支持自定义。如加上超链接。TS 类型:`string \| TNode`[通用类型定义](https://github.com/Tencent/tdesign-vue-next/blob/develop/src/common.ts) | N
max | Number | 0 | 用于控制多选数量,值为 0 则不限制 | N
Expand Down
1 change: 1 addition & 0 deletions src/tree-select/tree-select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ export default defineComponent({
key={treeKey.value}
value={[...checked.value]}
hover
keys={props.keys}
data={props.data}
activable={!props.multiple}
checkable={props.multiple}
Expand Down
6 changes: 5 additions & 1 deletion src/tree-select/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { InputValue } from '../input';
import { PopupProps } from '../popup';
import { SelectInputProps } from '../select-input';
import { TagProps } from '../tag';
import { TreeProps, TreeNodeModel } from '../tree';
import { TreeProps, TreeNodeModel, TreeKeysType } from '../tree';
import { SelectInputValueChangeContext } from '../select-input';
import { PopupVisibleChangeContext } from '../popup';
import { TNode, TreeOptionData } from '../common';
Expand Down Expand Up @@ -70,6 +70,10 @@ export interface TdTreeSelectProps<DataOption extends TreeOptionData = TreeOptio
* 输入框的值,非受控属性
*/
defaultInputValue?: InputValue;
/**
* 用来定义 `value / label / children / disabled` 在 `data` 数据中对应的字段别名,示例:`{ value: 'key', label 'name', children: 'list' }`
*/
keys?: TreeKeysType;
/**
* 是否正在加载数据
* @default false
Expand Down

0 comments on commit 0021db5

Please sign in to comment.